This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func annotationsIn(selections: [PDFSelection]) -> [PDFAnnotation] { | |
if selections.count == 0 { return [] } | |
var results: [PDFAnnotation] = [] | |
for selection in selections { | |
//See if rect matches the annotations in this page | |
let page = selection.pages.first! | |
let bounds = selection.bounds(for: page) | |
for annotation in page.annotations { | |
if bounds.intersects(annotation.bounds) { | |
results.append(annotation) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override func viewDidLoad() { | |
createMenu() | |
} | |
private func createMenu() { | |
let highlightItem = UIMenuItem(title: "Highlight", action: #selector(highlight(_:))) | |
UIMenuController.shared.menuItems = [highlightItem] | |
} | |
@objc private func highlight(_ sender: UIMenuController?) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function MVCToWKT(arr){ | |
var result = 'POLYGON('; | |
for(ring = 0; ring < arr.length; ring++) { | |
var strRing = '('; | |
for(i = 0; i < arr.getAt(ring).length; i++) { | |
strRing += (i > 0 ? ", " : "") + arr.getAt(ring).getAt(i).lng() + ' ' + arr.getAt(ring).getAt(i).lat(); | |
} | |
//Add the first point to the end to close polygon | |
strRing += ', '+arr.getAt(ring).getAt(0).lng() + ' ' + arr.getAt(ring).getAt(0).lat(); | |
strRing += ')'; |