[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

api[apple,MapKit] methods


self print: '// Note: we implement MKAnnotation as a class, but it is really a protocol'!
MKAnnotation buildTypedGetters: #(
	#(coordinate #CLLocationCoordinate2D)
)!
MKAnnotation buildGetters: #(
	title subtitle
)!
MKAnnotation buildFunctions: #(
	#(#setCoordinate: #(#(coordinate handle)))
)!

MKAnnotationView buildPool: #MKAnnotationViewDragState with: #(
    0 #MKAnnotationViewDragStateNone
    #MKAnnotationViewDragStateStarting
    #MKAnnotationViewDragStateDragging
    #MKAnnotationViewDragStateCanceling
    #MKAnnotationViewDragStateEnding
)!

! MKAnnotationView class methodsFor: #instantiation !
withAnnotation: annotation reuseIdentifier: reuseIdentifier
	^self @ (self nativeClass
		instanceWithAnnotation: annotation handle
		reuseIdentifier: reuseIdentifier)! !

MKAnnotationView buildGetters: #(
	reuseIdentifier
)!
MKAnnotationView buildFunctions: #(
	prepareForReuse
)!
| more |
more := #iOS = TargetOS ifTrue: [#(
	#(image #UIImage)
	#(leftCalloutAccessoryView #UIView)
	#(rightCalloutAccessoryView #UIView)
)] ifFalse: [#(
	#(image #NSImage)
	#(leftCalloutOffset #CGPoint)
	#(rightCalloutOffset #CGPoint)
	#(leftCalloutAccessoryView #NSView)
	#(rightCalloutAccessoryView #NSView)
)].
MKAnnotationView buildTypedAccessors: #(
	#(annotation #MKAnnotation)
	#(centerOffset #CGPoint)
	#(calloutOffset #CGPoint)
),more!
MKAnnotationView buildBooleanAccessors: #(
	enabled highlighted selected draggable
	canShowCallout
)!
MKAnnotationView buildNumberAccessors: #(
	dragState
)!
MKAnnotationView buildFunctions: #(
	#(#setSelected:animated: #(selected animated))
	#(#setDragState:animated: #(state animated))
)!
(Smalltalk includesKey: #NSFormatter) ifTrue: [
	NSFormatter subclass: #MKDistanceFormatter category: #MapKit.
]!
(Smalltalk includesKey: #MKDistanceFormatter) ifTrue: [
	MKDistanceFormatter buildFunctions: #(
		#(#stringFromDistance: #(#(distance handle)))
		#(#distanceFromString: #(#(distance handle)) #CLLocationDistance)
	).
	MKDistanceFormatter buildTypedAccessors: #(
		#(locale #NSLocale)
	).
	MKDistanceFormatter buildNumberAccessors: #(
		units unitStyle
	).
	MKDistanceFormatter buildPool: #MKDistanceFormatterUnits with: #(
 		0 #MKDistanceFormatterUnitsDefault
		#MKDistanceFormatterUnitsMetric
		#MKDistanceFormatterUnitsImperial
		#MKDistanceFormatterUnitsImperialWithYards
	).
	MKDistanceFormatter buildPool: #MKDistanceFormatterUnitStyle with: #(
 		0 #MKDistanceFormatterUnitStyleDefault
		#MKDistanceFormatterUnitStyleAbbreviated
		#MKDistanceFormatterUnitStyleFull
	).
]!

"MKGeometry.h not implemented. Yet"!

MKMapItem buildTypedGetters: #(
	#(placemark #MKPlacemark)
	#(url #NSURL)
)!
MKMapItem buildBooleanGetters: #(
	isCurrentLocation
)!
MKMapItem buildAccessors: #(
	name phoneNumber
)!
MKMapItem buildFunctions: #(
	#(#openInMapsWithLaunchOptions: #(#(options json)))
)!
! MKMapItem class methodsFor: #instantiation !
forCurrentLocation

	^self @ self nativeClass mapItemForCurrentLocation!

withPlacemark: placemark

	^self @ (self nativeClass instanceWithPlacemark: placemark handle)!

openMapsWithItems: mapItems launchOptions: options

	^self nativeClass
		openMapsWithItems: mapItems handles
		launchOptions: options json! !

MKMapView buildPool: #MKUserTrackingMode with: #(
 	0 #MKUserTrackingModeNone
	#MKUserTrackingModeFollow
	#MKUserTrackingModeFollowWithHeading
)!

MKMapView buildNumberAccessors: #(
	mapType
)!
MKMapView buildTypedAccessors: #(
	#(delegate #NSObject)
	#(region #MKCoordinateRegion)
	#(centerCoordinate #CLLocationCoordinate2D)
	#(visibleMapRect #MKMapRect)
	#(camera #MKMapCamera)
)!
MKMapView buildFunctions: #(
	#(#setRegion:animated: #(#(region handle) animated))
	#(#setCenterCoordinate:animated: #(#(coordinate handle) animated))
	#(#regionThatFits: #(#(region handle)) #MKCoordinateRegion)
	#(#setVisibleMapRect:animated: #(#(mapRect handle) animated))
	#(#mapRectThatFits: #(#(mapRect handle)) #MKMapRect)
	#(#setVisibleMapRect:edgePadding:animated: #(#(mapRect handle) #(insets handle) animated))
	#(#mapRectThatFits:edgePadding: #(#(mapRect handle) #(insets handle)) #MKMapRect)
	#(#setCamera:animated: #(#(camera handle) animated))
	#(#convertCoordinate:toPointToView: #(#(coordinate handle) #(view handle)) #CGPoint)
	#(#convertPoint:toCoordinateFromView: #(#(point handle) #(view handle)) #CLLocationCoordinate2D)
	#(#convertRegion:toRectToView: #(#(region handle) #(view handle)) #CGRect)
	#(#convertRect:toRegionFromView: #(#(rect handle) #(view handle)) #MKCoordinateRegion)
)!
MKMapView buildIsBooleanAccesors: #(
	zoomEnabled scrollEnabled
	rotateEnabled pitchEnabled
	userLocationVisible
)!
#iOS = TargetOS ifFalse: [
	MKMapView buildBooleanAccesors: #(
		showsCompass showsZoomControls showsScale
	)
]!
MKMapView buildBooleanAccesors: #(
	showsPointsOfInterest showsBuildings
	showsUserLocation
)!
MKMapView buildTypedGetters: #(
	#(userLocation #MKUserLocation)
	#(annotationVisibleRect #CGRect)
)!
#iOS = TargetOS ifTrue: [
	MKMapView buildNumberAccessors: #(
		userTrackingMode
	).
	MKMapView buildFunctions: #(
		#(#setUserTrackingMode:animated: #(mode animated))
	)
]!
MKMapView buildFunctions: #(
	#(#addAnnotation: #(#(annotation handle)))
	#(#addAnnotations: #(#(annotations handles)))
	#(#removeAnnotation: #(#(annotation handle)))
	#(#removeAnnotations: #(#(annotations handles)))
	#(#annotationsInMapRect: #(#(mapRect handle)) #NSSet)
	#(#viewForAnnotation: #(#(annotation handle)) #MKAnnotationView)
	#(#dequeueReusableAnnotationViewWithIdentifier: #(identifier) #MKAnnotationView)
	#(#selectAnnotation:animated: #(#(annotation handle) animated))
	#(#deselectAnnotation:animated: #(#(annotation handle) animated))
	#(#showAnnotations:animated: #(#(annotation handle) animated))
)!
! MKMapView methodsFor: #accessing !
annotations
	^handle#annotations collect: [:each| MKAnnotation @ each ]! !

! MKMapView methodsFor: #accessing !
selectedAnnotations
	^handle#selectedAnnotations collect: [:each| MKAnnotation @ each ]! !

MKMapView buildPool: #MKOverlayLevel with: #(
 	0 #MKOverlayLevelAboveRoads
	#MKOverlayLevelAboveLabels
)!

MKMapView buildFunctions: #(
	#(#addOverlay:level: #(#(overlay handle) level))
	#(#addOverlays:level: #(#(overlays handles) level))
	#(#removeOverlay: #(#(overlay handle)))
	#(#removeOverlays: #(#(overlays handles)))
	#(#insertOverlay:atIndex:level: #(#(overlay handle) index level))
	#(#insertOverlay:aboveOverlay: #(#(overlay handle) #(sibling handle)))
	#(#insertOverlay:belowOverlay: #(#(overlay handle) #(sibling handle)))
	#(#exchangeOverlay:withOverlay: #(#(overlay handle) #(sibling handle)))
	#(#rendererForOverlay: #(#(overlay handle)) #MKOverlayRenderer)
)!

! MKMapView methodsFor: #accessing !
overlays
	^handle#overlays collect: [:each| MKOverlay @ each ]! !

! MKMapView methodsFor: #accessing !
overlaysInLevel: level
	^(handle #overlaysInLevel: level) collect: [:each| MKOverlay @ each ]! !

MKMapView buildFunctions: #(
	#(#addOverlay: #(#(overlay handle)))
	#(#addOverlays: #(#(overlays handles)))
	#(#insertOverlay:atIndex: #(#(overlay handle) index))
	#(#exchangeOverlayAtIndex:withOverlayAtIndex: #(index1 index2))
)!

MKAnnotationView subclass: #MKPinAnnotationView!

MKPinAnnotationView buildPool: #MKPinAnnotationColor with: #(
 	0 #MKPinAnnotationColorRed
	#MKPinAnnotationColorGreen
	#MKPinAnnotationColorPurple
)!
MKPinAnnotationView buildNumberAccessors: #(
	pinColor
)!
MKPinAnnotationView buildBooleanAccessors: #(
	animatesDrop
)!

MKUserLocation buildIsBooleanGetters: #(
	updating
)!
MKUserLocation buildTypedAccessors: #(
	#(location #CLLocation)
	#(heading #CLHeading)
)!
MKUserLocation buildAccessors: #(
	title subtitle
)!

MKMapView buildPool: #MKMapType with: #(
 	0 #MKMapTypeStandard
	#MKMapTypeSatellite
	#MKMapTypeHybrid
)!
MKMapView buildPool: #MKErrorCode with: #(
 	1 #MKErrorUnknown
	#MKErrorServerFailure
	#MKErrorLoadingThrottled
	#MKErrorPlacemarkNotFound
	#MKErrorDirectionsNotFound
)!

self print: '// Note: we implement MKOverlay as a class, but it is really a protocol'.
MKAnnotation sublass: #MKOverlay category: #MapKit!

MKOverlay buildTypedGetters: #(
	#(boundingMapRect #MKMapRect)
)!
MKOverlay buildFunctions: #(
	#(#intersectsMapRect: #(#(mapRect handle)))
	#(canReplaceMapContent #())
)!

MKAnnotation subclass: #MKShape!
MKShape buildAccessors: #(
	title subtitle
)!
MKShape subclass: #MKPointAnnotation!
MKPointAnnotation buildTypedAccessors: #(
	#(coordinate #CLLocationCoordinate2D)
)!

MKShape subclass: #MKMultiPoint!
MKMultiPoint buildNumberGetters: #(
	pointCount
)!
MKMultiPoint buildFunctions: #(
	#(#getCoordinates:range: #(#(coords handle) #(range handle)))
)!

MKShape subclass: #MKPolyline!
! MKPolyline class methodsFor: #instantiation !
withPoints: points count: count
	^self @ (self nativeClass
		#polylineWithPoints: points handles
		count: count)! !
! MKPolyline class methodsFor: #instantiation !
withCoordinates: coords count: count
	^self @ (self nativeClass
		#polylineWithCoordinates: coords handles
		count: count)! !

MKMultiPoint subclass: #MKPolygon!
! MKPolygon class methodsFor: #instantiation !
withPoints: points count: count
	^self @ (self nativeClass
		#polygonWithPoints: points handles
		count: count)! !
! MKPolygon class methodsFor: #instantiation !
withPoints: points count: count interiorPolygons: interiorPolygons
	^self @ (self nativeClass
		#polygonWithPoints: points handles
		count: count
		interiorPolygons: interiorPolygons handles)! !
! MKPolygon class methodsFor: #instantiation !
withCoordinates: coords count: count
	^self @ (self nativeClass
		#polygonWithCoordinates: coords handles
		count: count)! !
! MKPolygon class methodsFor: #instantiation !
withCoordinates: coords count: count interiorPolygons: interiorPolygons
	^self @ (self nativeClass
		#polygonWithCoordinates: coords handles
		count: count
		interiorPolygons: interiorPolygons handles)! !
! MKPolygon methodsFor: #accessing !
interiorPolygons
	^handle#interiorPolygons collect: [:each | MKPolygon @ each ]! !

MKShape subclass: #MKCircle!
! MKCircle class methodsFor: #instantiation !
withCenterCoordinate: coord radius: radius
	^self @ (self nativeClass
		#circleWithCenterCoordinate: coord handle
		radius: radius)! !
! MKCircle class methodsFor: #instantiation !
withMapRect: mapRect
	^self @ (self nativeClass
		#circleWithMapRect: mapRect handle)! !
MKCircle buildTypedGetters: #(
	#(coordinate #CLLocationCoordinate2D)
	#(boundingMapRect #MKMapRect)
)!
MKCircle buildNumberGetters: #(
	radius
)!

MKPolyline subclass: #MKGeodesicPolyline!

! MKOverlayRenderer class methodsFor: #instantiation !
withOverlay: overlay
	^ self @ (self nativeClass instanceWithOverlay: overlay handle)! !

MKOverlayRenderer buildTypedGetters: #(
	#(overlay #MKOverlay)
)!
MKOverlayRenderer buildFunctions: #(
	#(#pointForMapPoint: #(#(mapPoint handle)) #CGPoint)
	#(#mapPointForPoint: #(#(point handle)) #MKMapPoint)
	#(#rectForMapRect: #(#(mapRect handle)) #CGRect)
	#(#mapRectForRect: #(#(rect handle)) #MKMapRect)
	#(#canDrawMapRect:zoomScale: #(#(mapRect handle) zoomScale))
	#(#drawMapRect:zoomScale:inContext: #(#(mapRect handle) zoomScale #(context handle)))
	setNeedsDisplay
	#(#setNeedsDisplayInMapRect: #(#(mapRect handle)))
	#(#setNeedsDisplayInMapRect:zoomScale: #(#(mapRect handle) zoomScale))
)!
MKOverlayRenderer buildNumberAccessors: #(
	alpha
)!
MKOverlayRenderer buildNumberGetters: #(
	contentScaleFactor
)!
MKOverlayRenderer subclass: #MKOverlayPathRenderer!
| color |
color := (#iOS = TargetOS ifTrue: [UIColor] ifFalse: [NSColor]).
MKOverlayRenderer buildTypedAccessors: (Array
	with:(Array with: #fillColor with: color)
	with:(Array with: #strokeColor with: color)
),	#(
	#(path #CGPathRef)
)!
MKOverlayRenderer buildNumberAccessors: #(
	lineWidth lineJoin lineCap
	miterLimit lineDashPhase
)!
MKOverlayRenderer buildAccessors: #(
	lineDashPattern
)!
MKOverlayRenderer buildFunctions: #(
	createPath invalidatePath
	#(#applyStrokePropertiesToContext:atZoomScale: #(#(context handle) zoomScale))
	#(#applyFillPropertiesToContext:atZoomScale: #(#(context handle) zoomScale))
	#(#strokePath:inContext: #(#(path handle) #(context handle)))
	#(#fillPath:inContext: #(#(path handle) #(context handle)))
)!

MKOverlayPathRenderer subclass: #MKPolygonRenderer!
MKPolygonRenderer buildTypedGetters: #(
	#(polygon #MKPolygon)
)!
! MKPolygonRenderer class methodsFor: #instantiation !
withPolygon: polygon
	^ self @ (self nativeClass instanceWithPolygon: polygon handle)! !

MKOverlayPathRenderer subclass: #MKPolylineRenderer!
MKPolylineRenderer buildTypedGetters: #(
	#(polyline #MKPolyline)
)!
! MKPolylineRenderer class methodsFor: #instantiation !
withPolyline: polyline
	^ self @ (self nativeClass instanceWithPolyline: polyline handle)! !

MKOverlayPathRenderer subclass: #MKCircleRenderer!
MKCircleRenderer buildTypedGetters: #(
	#(circle #MKCircle)
)!
! MKCircleRenderer class methodsFor: #instantiation !
withCircle: circle
	^ self @ (self nativeClass instanceWithCircle: circle handle)! !


! MKLocalSearch class methodsFor: #instantiation !
withRequest: request
	^ self @ (self nativeClass instanceWithRequest: request handle)! !

MKLocalSearch buildFunctions: #(
	cancel
	#(#startWithCompletionHandler: #(#(completionHandler handle)))
)!
MKLocalSearch buildIsBooleanGetters: #(
	searching
)!

MKLocalSearchRequest buildAccessors: #(
	naturalLanguageQuery
)!
MKLocalSearchRequest buildTypedAccessors: #(
	#(region #MKCoordinateRegion)
)!

! MKLocalSearchResponse methodsFor: #accessing !
mapItems
	^handle#mapItems collect: [:each| MKMapItem @ each ]! !

MKLocalSearchResponse buildTypedAccessors: #(
	#(boundingRegion #MKCoordinateRegion)
)!

MKDirectionsRequest buildTypedAccessors: #(
	#(source #MKMapItem)
	#(destination #MKMapItem)
	#(transportType #MKDirectionsTransportType)
	#(departureDate #NSDate)
	#(arrivalDate #NSDate)
)!
MKDirectionsRequest buildFunctions: #(
	#(#setSource: #(#(aMKMapItem handle)))
	#(#setDestination: #(#(aMKMapItem handle)))
)!
MKDirectionsRequest buildBooleanAccessors: #(
	requestsAlternateRoutes
)!

! MKDirectionsRequest class methodsFor: #instantiation !
withContentsOfURL: url
	^self @ (self nativeClass instanceWithContentsOfURL: url handle)! !
! MKDirectionsRequest class methodsFor: #query !
isDirectionsRequestURL: url
	^self nativeClass isDirectionsRequestURL: url handle! !

! MKDirections class methodsFor: #instantiation !
withRequest: request
	^self @ (self nativeClass instanceWithRequest: request handle)! !
MKDirections buildFunctions: #(
	cancel
	#(#calculateDirectionsWithCompletionHandler: #(#(completionHandler handle)))
	#(#calculateETAWithCompletionHandler: #(#(completionHandler handle)))
)!
MKDirections buildIsBooleanGetters: #(
	calculating
)!

MKDirectionsResponse buildTypedGetters: #(
	#(source #MKMapItem)
	#(destination #MKMapItem)
)!
! MKDirectionsResponse methodsFor: #accessing !
routes
	^handle#routes collect: [:each| MKRoute @ each ]! !

NSObject subclass: #MKRoute!
MKRoute buildGetters: #(
	name advisoryNotices
)!
MKRoute buildTypedGetters: #(
	#(distance #CLLocationDistance)
	#(polyline #MKPolyline)
)!
MKRoute buildNumberGetters: #(
	expectedTravelTime transportType
)!
! MKRoute methodsFor: #accessing !
steps
	^handle#steps collect: [:each| MKRouteStep @ each ]! !

NSObject subclass: #MKRouteStep!
MKRouteStep buildGetters: #(
	instructions notice
)!
MKRouteStep buildTypedGetters: #(
	#(polyline #MKPolyline)
)!
MKRouteStep buildNumberGetters: #(
	distance transportType
)!

NSObject subclass: #MKETAResponse!
MKETAResponse buildTypedGetters: #(
	#(source #MKMapItem)
	#(destination #MKMapItem)
)!
MKETAResponse buildNumberGetters: #(
	expectedTravelTime
)!

MKMapSnapshotOptions buildTypedAccessors: #(
	#(camera #MKMapCamera)
	#(mapRect #MKMapRect)
	#(region #MKCoordinateRegion)
)!
MKMapSnapshotOptions buildNumberAccessors: #(
	mapType
)!
MKMapSnapshotOptions buildBooleanAccessors: #(
	showsPointsOfInterest showsBuildings
)!
#iOS = TargetOS ifTrue: [
	MKMapSnapshotOptions buildTypedAccessors: #(
		#(size #CGSize)
	).
	MKMapSnapshotOptions buildNumberAccessors: #(
		scale
	).
] ifFalse: [
	MKMapSnapshotOptions buildTypedAccessors: #(
		#(size #NSSize)
	).
]!

! MKMapSnapshotter class methodsFor: #instantiation !
withOptions: aMKMapSnapshotOptions
	^self @ (self nativeClass instanceWithOptions: aMKMapSnapshotOptions handle)! !
MKMapSnapshotter buildFunctions: #(
	cancel
	#(#startWithCompletionHandler: #(#(completionHandler handle)))
	#(#startWithQueue:completionHandler: #(#(queue handle) #(completionHandler handle)))
)!
MKMapSnapshotter buildIsBooleanGetters: #(
	loading
)!

#iOS = TargetOS ifTrue: [
	MKMapSnapshot buildTypedGetters: #(
		#(image #UIImage)
	).
	MKMapSnapshot buildFunctions: #(
		#(#pointForCoordinate: #(#(coordinate handle)) #CGPoint)
	).
] ifFalse: [
	MKMapSnapshot buildTypedGetters: #(
		#(image #NSImage)
	).
	MKMapSnapshot buildFunctions: #(
		#(#pointForCoordinate: #(#(coordinate handle)) #NSPoint)
	).
]!

! MKTileOverlay class methodsFor: #instantiation !
withURLTemplate: urlTemplateString
	^self @ (self nativeClass instanceWithURLTemplate: urlTemplateString)! !
 
MKTileOverlay buildTypedAccessors: #(
	#(tileSize #CGSize)
)!
MKTileOverlay buildIsBooleanAccessors: #(
	geometryFlipped
)!
MKTileOverlay buildNumberAccessors: #(
	minimumZ maximumZ
)!
! MKTileOverlay methodsFor: #accessing !
urlTemplate
	^handle#URLTemplate! !
MKTileOverlay buildBooleanAccessors: #(
	canReplaceMapContent
)!

MKOverlayRenderer subclass: #MKTileOverlayRenderer!
! MKOverlayRenderer class methodsFor: #instantiation !
withTileOverlay: overlay
	^self @ (self nativeClass instanceWithTileOverlay: overlay handle)! !
MKTileOverlayRenderer buildFunctions: #(
	reloadData
)!

MKMapCamera buildTypedAccessors: #(
	#(centerCoordinate #CLLocationCoordinate2D)
)!
MKMapCamera buildNumberAccessors: #(
	heading pitch altitude
)!

! MKMapCamera class methodsFor: #instantiation !
current
	^self @ self nativeClass camera! !
! MKMapCamera class methodsFor: #instantiation !
lookingAtCenterCoordinate: centerCoordinate fromEyeCoordinate: eyeCoordinate eyeAltitude: eyeAltitude
	^self @ (self nativeClass
		cameraLookingAtCenterCoordinate: centerCoordinate handle
		fromEyeCoordinate: eyeCoordinate handle
		eyeAltitude: eyeAltitude)! !