最近 GitHub が会社で騒がれている。というのも Esri が GitHub 推しだからだ。GitHub には Gist というソースコードを単体で管理できるサービスもある。仕事柄大きなプロジェクトでコードを書くよりも小さいコードを書いてトレーニングやサポートで再利用するので、Gist はいろいろ可能性がありそうです。
Gist で公開したスニペットを WordPress で表示するプラグインがあったので紹介しておきます。
実際に適用するとこんな感じです。Gist の URL を本文に入力するだけで表示できます。書いたのはこの1行だけ(""は除きます)。便利そうです。
This file contains hidden or 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
'レイアウト ビューでマウス クリック地点の用紙座標とマップ座標の両方を取得する方法
Private Sub UIToolControl1_MouseDown(ByVal button As Long, ByVal shift As Long, ByVal x As Long, ByVal y As Long)
Dim pMxDocument As IMxDocument
Set pMxDocument = ThisDocument
Dim pPoint As IPoint
Set pPoint = pMxDocument.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(x, y)
Debug.Print "FormPoint:", pPoint.x, pPoint.y '用紙座標
Dim pGCS As IGraphicsContainerSelect
Set pGCS = pMxDocument.PageLayout
Dim pMapFrame As IMapFrame
Set pMapFrame = pGCS.SelectedElement(0) '事前にマップ フレームを選択状態にしておくこと
Dim pActiveView As IActiveView
Set pActiveView = pMapFrame.Map
Dim pMapPoint As IPoint
Set pMapPoint = pActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(x, y)
Debug.Print "MapPoint:", pMapPoint.x, pMapPoint.y 'マップ座標
End Sub
目次
追記
oEmbed Gist 4.9.1 未満には脆弱性があるようです。また、現在は公式プラグインからも削除されています。
JetPack → 設定 → 執筆 → 作成 → 「ショートコードを使って作成し、人気サイトからメディアを埋め込む」を有効化すると、URL貼り付けだけでコードが埋め込まれます。
