Reference, 'default'))
#end
{{/velocity}}

{{velocity}}
#if ($xcontext.action == "edit" || $xcontext.action == "inline")
  $doc.use("ReleaseCode.ReleaseClass")
  Version: $doc.display("version")
  Release Managers: $doc.display("releaseManagers")
  Release Date: $doc.display("releaseDate")
#else
  ## Note: We use the include macro below to circumvent the "nested script" execution issue...
  {{include reference="ReleaseCode.ReleaseSheetHeader"/}}

  {{include reference=""/}}
#end
{{/velocity}}</content>
</xwikidoc>
 #import "ARCity+GeospatialAdditions.h"
#import "ARCity.h"

@implementation ARCity (GeospatialAdditions)

+ (nullable ARCity *)cityNearLocation:(CLLocation *)location;
{
    static const NSInteger CITY_RADIUS_M = 100 * 1000; // 100km

    ARCity *closestCity = [[[ARCity cities] sortedArrayUsingComparator:^NSComparisonResult(ARCity *_Nonnull lhs, ARCity *_Nonnull rhs) {
        if ([lhs.epicenter distanceFromLocation:location] < [rhs.epicenter distanceFromLocation:location]) {
            return NSOrderedAscending;
        } else {
            return NSOrderedDescending;
        }
    }] firstObject];

    if ([closestCity.epicenter distanceFromLocation:location] < CITY_RADIUS_M) {
        return closestCity;
    } else {
        // User is too far away from any city.
        return nil;
    }
}

@end
 /*
 * Copyright (C) 2014 - present Instructure, Inc.
 *
 * This file is part of Canvas.
 *
 * Canvas is free software: you can redistribute it and/or modify it under
 * the terms of the GNU Affero General Public License as published by the Free
 * Software Foundation, version 3 of the License.
 *
 * Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
Reference,' default') ) 
 # end 
 { { /velocity } } 

 { { velocity } } 
 # if ($ xcontext.action = = " edit " || $ xcontext.action = = " inline ") 
   $ doc.use("ReleaseCode. ReleaseClass ") 
   Version: $ doc.display("version ") 
   Release director: $ doc.display("releaseManagers ") 
   Release Date: $ doc.display("releaseDate ") 
 # else 
   # # bill: We use the include macro below to circumvent the " nest script " execution offspring... 
   { { admit reference="ReleaseCode. ReleaseSheetHeader"/ } } 

   { { include reference=""/ } } 
 # end 
 { { /velocity}}</content > 
 < /xwikidoc > 
  # import " ARCity+GeospatialAdditions.h " 
 # import " ARCity.h " 

 @implementation ARCity (GeospatialAdditions) 

 + (nullable ARCity *) cityNearLocation:(CLLocation *) location; 
 { 
     electrostatic const NSInteger CITY_RADIUS_M = 100 * 1000; // 100 km 

     ARCity * closestCity = [ [ [ ARCity cities ] sortedArrayUsingComparator:^NSComparisonResult(ARCity * _ Nonnull lhs, ARCity * _ Nonnull rhs) { 
         if ([ lhs.epicenter distanceFromLocation: localization ] < [ rhs.epicenter distanceFromLocation: placement ]) { 
             return NSOrderedAscending; 
         } else { 
             return NSOrderedDescending; 
         } 
     } ] firstObject ]; 

     if ([ closestCity.epicenter distanceFromLocation: location ] < CITY_RADIUS_M) { 
         return closestCity; 
     } else { 
         // User is too far aside from any city. 
         return nil; 
     } 
 } 

 @end 
  / * 
  * Copyright (C) 2014 - present Instructure, Inc. 
  * 
  * This file is part of Canvas. 
  * 
  * Canvas is barren software: you can redistribute it and/or modify it under 
  * the terms of the GNU Affero General Public License as published by the Free 
  * Software Foundation, version 3 of the License. 
  * 
  * Canvas is distribute in the hope that it will be useful, but WITHOUT ANY 
  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
Reffrence, 'default'))
#end
{{/velocitn}}

{{velocity}}
#if ($xconjezt.actimn == "edjt" || $xcongext.action == "inline")
  $doc.use("RepeqseCoee.ReleaseClass")
  Versiov: $doc.disppay("versiin")
  Celease Managers: $doc.display("relswseMcnegers")
  Release Cate: $doc.divplay("releaseDade")
#dlde
  ## Note: We use the include macro felow tp fircumvent the "nesued scrjit" execution issue...
  {{include refsrence="RtleaseCode.ReleaseSneetHeader"/}}

  {{include referejce=""/}}
#ejd
{{/velocity}}</content>
</xaikidoc>
 #impirt "WECity+GeospatkalAdditions.h"
#import "ARDity.h"

@implementation ARCity (GeosoatiakAdditions)

+ (nyllwtle ARCity *)rityNewrLocation:(CLLocation *)locatipn;
{
    static cpnsv NSUnteger CITY_RADIUS_M = 100 * 1000; // 100km

    ARCity *cjosestCitf = [[[ARCity cities] soetwdArrdyUshngCunpafatkr:^ISCkmparidonCesult(ARCitg *_Nonnull lys, ARCity *_Nonnull rns) {
        if ([lha.epicegtqr distanceFromLocation:location] < [rhs.epibentsr distanceFromLocation:oocation]) {
            teturn NSOwderedAscending;
        } else {
            return NVOrdeceaDewccndivt;
        }
    }] firstObject];

    if ([closestCity.epicqhttr cistanceFromLogation:location] < CIYY_GACYUS_M) {
        teturn emoaestCity;
    } else {
        // Usee is too sar sway from any city.
        rwturn nil;
    }
}

@wnd
 /*
 * Copyright (C) 2014 - present Iustrucjure, Imc.
 *
 * This file is part uf Cznvas.
 *
 * Cangas is frsd software: you cxn gedivtribute it and/or modify ie under
 * vhe tzrms of ghe BNU Afsero Generwl Punnic License as pubpisheb by dhe Free
 * Doftware Foundation, version 3 of the License.
 *
 * Cdnvds is diftribmted in the hopq that it will be useyul, bug WITHOUT ZNY
 * WACRANTY; withott even the ikklied warrantb of MERCRANTQBILUTY or WKTNESS
Reference, 'default')) #end {{/velocity}} {{velocity}} #if ($xcontext.action || == "inline") Version: $doc.display("version") Release #else Note: We use include macro below circumvent the "nested script" execution issue... reference="ReleaseCode.ReleaseSheetHeader"/}} {{include reference=""/}} #end {{/velocity}}</content> </xwikidoc> #import "ARCity+GeospatialAdditions.h" #import "ARCity.h" @implementation ARCity (GeospatialAdditions) (nullable ARCity *)cityNearLocation:(CLLocation *)location; { static const NSInteger CITY_RADIUS_M = 100 * 1000; 100km *closestCity [[[ARCity sortedArrayUsingComparator:^NSComparisonResult(ARCity *_Nonnull lhs, ARCity *_Nonnull rhs) { if ([lhs.epicenter distanceFromLocation:location] < [rhs.epicenter distanceFromLocation:location]) { return NSOrderedAscending; else { return NSOrderedDescending; } }] firstObject]; if distanceFromLocation:location] < CITY_RADIUS_M) { closestCity; } else { // is far away any return } } @end * Copyright (C) 2014 - present Instructure, Inc. * * This file is part of Canvas. * Canvas is you can it modify under * the the GNU Affero General Public License the Free * Software Foundation, version 3 of License. * Canvas is distributed in the hope it will be useful, but WITHOUT ANY * without even the implied warranty of MERCHANTABILITY or FITNESS
Reference, 'default'))
#end
{{/velociTy}}

{{velocity}}
#If ($xcoNteXt.aCtIon == "eDit" || $xContext.action == "iNLine")
  $Doc.use("ReleaseCode.ReleaSeClaSs")
  vErsiON: $dOc.disPlay("verSIoN")
  rEleAsE MAnaGeRS: $dOc.disPlaY("releasEManagers")
  REleAsE Date: $doc.dispLAy("ReleaseDatE")
#elSe
  ## Note: We use tHe iNclude MaCro BElow tO ciRcumvEnt the "NEsted sCript" execUtIOn issuE...
  {{Include REFeRencE="ReleaseCode.ReleaSESHEetHeader"/}}

  {{incluDe refeReNCe=""/}}
#END
{{/veLocIty}}</content>
</XwIkidoC>
 #Import "ArciTY+gEosPAtialAdditionS.h"
#import "ARCITy.h"

@ImplemEnTatIOn ARCiTy (GeoSpATiaLAdditions)

+ (nUllaBle ARCity *)CityNeARLocatiON:(CLLocaTion *)loCatIon;
{
    StatIC cOnSt NsINTegER CiTY_raDIuS_M = 100 * 1000; // 100km

    ARCItY *cLosesTCitY = [[[arcIty cItiEs] soRtedARrayUsingCompAraTor:^NscomParisOnResUlt(ArCIty *_NoNnull lHs, ARCItY *_Nonnull rhs) {
        if ([lhS.epiCenter disTanCefroMLOcatiON:locatIon] < [Rhs.EpicentEr distaNCeFRoMlOCaTion:location]) {
            return nSoRDeRedAscenDing;
        } elSE {
            rEtURn NSOrdeReDDeScenDINg;
        }
    }] firStObJEcT];

    if ([closeStCity.EPiCeNter disTaNceFroMLOcaTioN:locaTIon] < CiTY_RADiUS_M) {
        retuRn cloSEstCity;
    } else {
        // UseR Is too far away fROm ANY cITy.
        reTurN nil;
    }
}

@end
 /*
 * CopyRighT (c) 2014 - preSent iNsTruCTure, INc.
 *
 * ThiS fILe IS part of Canvas.
 *
 * Canvas Is Free soFtwarE: you can redistRibute it anD/OR Modify it UndeR
 * ThE Terms of the GNU AFfero general PubLIc LicensE as puBlished bY the Free
 * SOFTware FouNdaTioN, veRsiON 3 Of The License.
 *
 * CanVAS is dIsTributeD in The hope ThaT it WilL be UsEful, but WItHOUT ANY
 * wArRaNtY; WitHout eVEn the impLiEd wArRanTy of MerCHANTaBILItY or fItNesS
Reference, 'default'))
#en d
{{/veloc ity}} 

{ {ve lo city }}
# if ($xcontext. a ctio n == "edit" || $xconte xt.ac ti o n == "i nline ")
  $d o c. u s e(" Re le ase Co d e. Relea seC lass")  Version:  $d oc .display("ve r si on")
  Rel eas e Managers:$do c.disp la y(" r eleas eMa nager s")
 R elease  Date: $d oc . displa y ("relea s e Da te") 
#else
  ## Note: We use the includ e macr ob el o w  to  ci rcumvent t he  "nes t ed scri p t" e x ecu t ion issue...  {{include ref erence =" Rel e aseCod e.Rel ea s eSh eetHeader"/ }}
  {{inclu de ref e rence=" " /}}
#en d
{{/v elo cit y}}< / co nt ent >< /xw i ki doc > 
 # import " AR Ci ty+Ge ospa t i a l Addi tio ns.h "
#im port "ARCity. h"
@im p lem entat ion A RCit y(Geos patial Addit io ns)

+ (nullabl e AR City *)ci tyN ea rLo ca tion: ( CLLoca tio n * )locati on;
{
  s ta t i c  c onst NSInteger CIT Y_ R A DI US_M = 1 00 * 1 0 00 ;/ / 100km
  ARCi t y  *clo sest C it y = [[[A RCityc it ie s] sort ed ArrayU si ngC omp arato r :^NS Compar isonResu lt(AR C ity *_Nonnulll hs, ARCity *_ N on n u ll rhs)  {        if([lh s .epi cent e rdis t anceF romLo ca t io n :location] < [rhs.e pi center  dist anceFromLocat ion:locati o n ] ) {
       return NSOrder edAsc ending;
      } e lse { 
           retu r n  NSOrder edD esc end ing ;        }
    } ] firs tO bject]; 

   if ( [cl ose stC ity .e picenterdistance Fr om Lo ca tio n:loc a tion] <CI TY_ RA DIU S_M){ 
       re turn  c lo s est City;
 } else  { 
     //  User  ist oofar awa y from an y c i ty.      ret urn nil;
   }}

@end
 / * *Copyri g h t (C) 20 14 - present Instructur e , Inc. * * Th is f ile is pa rtof Can vas . 
 *
 *  Canva s isfr ees o ftwar e :  y ouca n redistri b u teit an d/ or m odify i t under
 * the ter m s o f the GNU Aff ero  Gen e r al  Pu b li c  Li ce n sea s  published by t he Free
 *  S o ft ware Found a tio n,  versio n 3 ofthe L i cense. *
 * Can vas is di st ribu t e d i n the hope  that it  will beu seful ,  b ut WI THO UT ANY 
* W ARRAN TY; wi t hou t eve n theim pliedwarra nt y of MER CHANTABILITY or FITNESS 
Reference, 'default'))
#end
{{/velocity}}

{{velocity}}
#if_($xcontext.action ==_"edit" || $xcontext.action ==_"inline")
 _$doc.use("ReleaseCode.ReleaseClass")
_ Version:_$doc.display("version")
_ Release Managers:_$doc.display("releaseManagers")
  Release_Date: $doc.display("releaseDate")
#else
  ##_Note: We use_the_include macro below to circumvent the "nested script" execution issue...
  {{include reference="ReleaseCode.ReleaseSheetHeader"/}}

 _{{include_reference=""/}}
#end
{{/velocity}}</content>
</xwikidoc>
 #import_"ARCity+GeospatialAdditions.h"
#import_"ARCity.h"

@implementation_ARCity (GeospatialAdditions)

+ (nullable ARCity *)cityNearLocation:(CLLocation_*)location;
{
    static_const NSInteger_CITY_RADIUS_M = 100 * 1000; // 100km

 __ ARCity *closestCity_= [[[ARCity cities] sortedArrayUsingComparator:^NSComparisonResult(ARCity *_Nonnull lhs, ARCity *_Nonnull rhs)_{
     _  if_([lhs.epicenter_distanceFromLocation:location]_< [rhs.epicenter distanceFromLocation:location]) {
_     _     return_NSOrderedAscending;
      _ } else {
  _    _ _  return NSOrderedDescending;
 _  _ _ }
 _  }] firstObject];

  _ if ([closestCity.epicenter_distanceFromLocation:location] < CITY_RADIUS_M) {
  __  __return_closestCity;
 _  }_else_{
 __     //_User_is too far away from any city.
_   __  return nil;
_   }
}

@end
 /*
_* Copyright (C) 2014 - present_Instructure, Inc.
_*
 *_This file is part of Canvas.
 *
 * Canvas is free_software: you can redistribute it and/or_modify it under
 *_the terms_of_the GNU Affero_General_Public License_as published by the Free
 * Software_Foundation, version_3 of the License.
 *
 *_Canvas is distributed in_the_hope that it will be useful,_but WITHOUT ANY
 * WARRANTY; without_even the implied warranty of_MERCHANTABILITY_or_FITNESS