Skip to content
This repository has been archived by the owner on Feb 3, 2023. It is now read-only.

Commit

Permalink
Merge pull request #4 from Esri/v.next
Browse files Browse the repository at this point in the history
V.next
  • Loading branch information
maryharvey authored Nov 14, 2016
2 parents 4c79e1d + a547bdd commit 914061b
Show file tree
Hide file tree
Showing 445 changed files with 16,408 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
arcgis-runtime-samples-macos.xcodeproj/project.xcworkspace/contents.xcworkspacedata
arcgis-runtime-samples-macos.xcodeproj/project.xcworkspace/xcuserdata/gaga7620.xcuserdatad/UserInterfaceState.xcuserstate
arcgis-runtime-samples-macos.xcodeproj/xcuserdata/gaga7620.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
arcgis-runtime-samples-macos.xcodeproj/xcuserdata/gaga7620.xcuserdatad/xcschemes/arcgis-runtime-samples-macos.xcscheme
arcgis-runtime-samples-macos.xcodeproj/xcuserdata/gaga7620.xcuserdatad/xcschemes/xcschememanagement.plist
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ limitations under the License.
A copy of the license is available in the repository's [license.txt]( https://github.com/Esri/arcgis-runtime-samples-macos/blob/master/license.txt) file.

[](Esri Tags: ArcGIS Runtime SDK macOS)
[](Esri Language: SWIFT)
[](Esri Language: SWIFT)
1,452 changes: 1,452 additions & 0 deletions arcgis-runtime-samples-macos.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions arcgis-runtime-samples-macos/3D/3D symbols/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#3D symbols

This sample demonstrates how to create 3D symbols with different shapes.

![](image1.png)

##How it works

The sample creates a symbol for each `AGSSimpleMarkerSymbolStyle`, namely

- Cone
- Cube
- Cylinder
- Diamond
- Sphere
- Tetrahedron

It then creates a `AGSGraphic` for each of these symbols and adds that graphic to the graphics overlay. The graphics are placed absolutely i.e. at the height above sea level.
36 changes: 36 additions & 0 deletions arcgis-runtime-samples-macos/3D/3D symbols/SceneSymbols.storyboard
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15F31a" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="UjM-JZ-dAX">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10116"/>
</dependencies>
<scenes>
<!--Scene Symbols View Controller-->
<scene sceneID="UZ6-3X-1Wr">
<objects>
<viewController id="UjM-JZ-dAX" customClass="SceneSymbolsViewController" customModule="OSXSampleViewer" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" id="l6b-NA-Eij">
<rect key="frame" x="0.0" y="0.0" width="450" height="300"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="3AG-B1-TgA" customClass="AGSSceneView">
<rect key="frame" x="0.0" y="0.0" width="450" height="300"/>
</customView>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="3AG-B1-TgA" secondAttribute="trailing" id="bcy-lb-aLm"/>
<constraint firstAttribute="bottom" secondItem="3AG-B1-TgA" secondAttribute="bottom" id="e52-8h-PHo"/>
<constraint firstItem="3AG-B1-TgA" firstAttribute="leading" secondItem="l6b-NA-Eij" secondAttribute="leading" id="nhT-Mc-V8S"/>
<constraint firstItem="3AG-B1-TgA" firstAttribute="top" secondItem="l6b-NA-Eij" secondAttribute="top" id="uzx-YH-KJD"/>
</constraints>
</view>
<connections>
<outlet property="sceneView" destination="3AG-B1-TgA" id="OuS-Qy-rHh"/>
</connections>
</viewController>
<customObject id="VkL-lD-CvO" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="317" y="402"/>
</scene>
</scenes>
</document>
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
//
// Copyright 2016 Esri.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

import Cocoa
import ArcGIS

class SceneSymbolsViewController: NSViewController {

@IBOutlet var sceneView:AGSSceneView!

private var graphicsOverlay = AGSGraphicsOverlay()

override func viewDidLoad() {
super.viewDidLoad()

let scene = AGSScene(basemap: AGSBasemap.nationalGeographicBasemap())
self.sceneView.scene = scene

//set the camera
let camera = AGSCamera(latitude: 48.97, longitude: 4.935, altitude: 2082, heading: 60, pitch: 75, roll: 0)
self.sceneView.setViewpointCamera(camera)

// add base surface for elevation data
let surface = AGSSurface()
let elevationSource = AGSArcGISTiledElevationSource(URL: NSURL(string: "https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer")!)
surface.elevationSources.append(elevationSource)
scene.baseSurface = surface

//add graphics overlay to the scene view
self.graphicsOverlay.sceneProperties?.surfacePlacement = .Absolute
self.sceneView.graphicsOverlays.addObject(graphicsOverlay)

//add graphics
self.addGraphics()
}

private func addGraphics() {
//coordinates for the first symbol
let x = 4.975
let y = 49.0
let z = 500.0

//create symbols for all the available 3D symbols
var symbols = [AGSSimpleMarkerSceneSymbol]()

//cone symbol
let coneSymbol = AGSSimpleMarkerSceneSymbol(style: .Cone, color: self.randColor(), height: 200, width: 200, depth: 200, anchorPosition: .Center)

//cube symbol
let cubeSymbol = AGSSimpleMarkerSceneSymbol(style: .Cube, color: self.randColor(), height: 200, width: 200, depth: 200, anchorPosition: .Center)

//cylinder symbo
let cylinderSymbol = AGSSimpleMarkerSceneSymbol(style: .Cylinder, color: self.randColor(), height: 200, width: 200, depth: 200, anchorPosition: .Center)

//diamond symbol
let diamondSymbol = AGSSimpleMarkerSceneSymbol(style: .Diamond, color: self.randColor(), height: 200, width: 200, depth: 200, anchorPosition: .Center)

//sphere symbol
let sphereSymbol = AGSSimpleMarkerSceneSymbol(style: .Sphere, color: self.randColor(), height: 200, width: 200, depth: 200, anchorPosition: .Center)

//tetrahedron symbol
let tetrahedronSymbol = AGSSimpleMarkerSceneSymbol(style: .Tetrahedron, color: self.randColor(), height: 200, width: 200, depth: 200, anchorPosition: .Center)

//add symbols to an array
symbols.appendContentsOf([coneSymbol, cubeSymbol, cylinderSymbol, diamondSymbol, sphereSymbol, tetrahedronSymbol])

//create graphics for each symbol
var graphics = [AGSGraphic]()

var i = 0
for symbol in symbols {
let point = AGSPoint(x: x + 0.01*Double(i), y: y, z: z, spatialReference: AGSSpatialReference.WGS84())
let graphic = AGSGraphic(geometry: point, symbol: symbol, attributes: nil)
graphics.append(graphic)
i = i+1
}

//add the graphics to the overlay
self.graphicsOverlay.graphics.addObjectsFromArray(graphics)
}

//returns a random color
private func randColor() -> NSColor {
return NSColor(red: self.randFloat(), green: self.randFloat(), blue: self.randFloat(), alpha: 1.0)
}

//returns a CGFloat between 0 and 1
private func randFloat() -> CGFloat {
return CGFloat(arc4random()%256)/256
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15F31a" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="Jrc-W1-TzK">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10116"/>
</dependencies>
<scenes>
<!--Display Scene View Controller-->
<scene sceneID="QQp-4c-g0j">
<objects>
<viewController id="Jrc-W1-TzK" customClass="DisplaySceneViewController" customModule="OSXSampleViewer" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" id="wWt-HJ-zAy">
<rect key="frame" x="0.0" y="0.0" width="450" height="300"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="22b-w2-0Dv" customClass="AGSSceneView">
<rect key="frame" x="0.0" y="0.0" width="450" height="300"/>
</customView>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="22b-w2-0Dv" secondAttribute="bottom" id="HYb-A1-wPB"/>
<constraint firstItem="22b-w2-0Dv" firstAttribute="leading" secondItem="wWt-HJ-zAy" secondAttribute="leading" id="eyI-b1-0GF"/>
<constraint firstItem="22b-w2-0Dv" firstAttribute="top" secondItem="wWt-HJ-zAy" secondAttribute="top" id="xWN-Jb-F6a"/>
<constraint firstAttribute="trailing" secondItem="22b-w2-0Dv" secondAttribute="trailing" id="yOD-Vh-etp"/>
</constraints>
</view>
<connections>
<outlet property="sceneView" destination="22b-w2-0Dv" id="Lri-hu-s4x"/>
</connections>
</viewController>
<customObject id="DGp-pW-uGQ" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="327" y="317"/>
</scene>
</scenes>
</document>
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//
// Copyright 2016 Esri.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

import Cocoa
import ArcGIS

class DisplaySceneViewController: NSViewController {

@IBOutlet var sceneView:AGSSceneView!

override func viewDidLoad() {
super.viewDidLoad()

//initialize scene with topographic basemap
let scene = AGSScene(basemap: AGSBasemap.imageryBasemap())
//assign scene to the scene view
self.sceneView.scene = scene

//set the viewpoint camera
let camera = AGSCamera(latitude: 45.74, longitude: 6.88, altitude: 4500, heading: 10, pitch: 70, roll: 0)
self.sceneView.setViewpointCamera(camera)

// add base surface for elevation data
let surface = AGSSurface()
let elevationSource = AGSArcGISTiledElevationSource(URL: NSURL(string: "https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer")!)
surface.elevationSources.append(elevationSource)
scene.baseSurface = surface
}

}
9 changes: 9 additions & 0 deletions arcgis-runtime-samples-macos/3D/Display a scene/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#Display a scene

This sample demonstrates how to display an scene with elevation data.

![](image1.png)

##How it works

The sample initializes an `AGSScene` with an `AGSBasemap`. It then assigns this scene to an `AGSSceneView`. For the elevation, it creates an `AGSSurface` and adds an `AGSArcGISTiledElevationSource` as an elevation source to the surface. The surface is then set as the `baseSurface` on the scene.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15F31a" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="TPp-1u-KrU">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10116"/>
</dependencies>
<scenes>
<!--Extrude Graphics View Controller-->
<scene sceneID="gvn-bG-m4a">
<objects>
<viewController id="TPp-1u-KrU" customClass="ExtrudeGraphicsViewController" customModule="OSXSampleViewer" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" id="Ree-Dp-TKS">
<rect key="frame" x="0.0" y="0.0" width="450" height="300"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="nBK-4f-iaX" customClass="AGSSceneView">
<rect key="frame" x="0.0" y="0.0" width="450" height="300"/>
</customView>
</subviews>
<constraints>
<constraint firstItem="nBK-4f-iaX" firstAttribute="leading" secondItem="Ree-Dp-TKS" secondAttribute="leading" id="5xt-l2-ug5"/>
<constraint firstAttribute="bottom" secondItem="nBK-4f-iaX" secondAttribute="bottom" id="JhY-TE-dhG"/>
<constraint firstAttribute="trailing" secondItem="nBK-4f-iaX" secondAttribute="trailing" id="cdA-QT-Ox5"/>
<constraint firstItem="nBK-4f-iaX" firstAttribute="top" secondItem="Ree-Dp-TKS" secondAttribute="top" id="se1-CH-fgj"/>
</constraints>
</view>
<connections>
<outlet property="sceneView" destination="nBK-4f-iaX" id="QF4-s5-81Q"/>
</connections>
</viewController>
<customObject id="Duq-ey-XJK" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="210" y="357"/>
</scene>
</scenes>
</document>
Loading

0 comments on commit 914061b

Please sign in to comment.