-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Classification primitive #5625
Classification primitive #5625
Changes from 11 commits
b371c27
9652e9d
337b334
2cfa4a5
2f45796
0ee8201
3d1ddc0
974218c
21a5fc9
bb54839
1037778
21238c2
ef09e3e
63eb4cc
c01305a
d3d1aaa
1ccd15b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"> <!-- Use Chrome Frame in IE --> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"> | ||
<meta name="description" content="Draw the intersection of a volume and a photgrammetry dataset."> | ||
<meta name="cesium-sandcastle-labels" content="Development"> | ||
<title>Cesium Demo</title> | ||
<script type="text/javascript" src="../Sandcastle-header.js"></script> | ||
<script type="text/javascript" src="../../../ThirdParty/requirejs-2.1.20/require.js"></script> | ||
<script type="text/javascript"> | ||
require.config({ | ||
baseUrl : '../../../Source', | ||
waitSeconds : 60 | ||
}); | ||
</script> | ||
</head> | ||
<body class="sandcastle-loading" data-sandcastle-bucket="bucket-requirejs.html"> | ||
<style> | ||
@import url(../templates/bucket.css); | ||
</style> | ||
<div id="cesiumContainer" class="fullSize"></div> | ||
<div id="loadingOverlay"><h1>Loading...</h1></div> | ||
<script id="cesium_sandcastle_script"> | ||
function startup(Cesium) { | ||
'use strict'; | ||
//Sandcastle_Begin | ||
var viewer = new Cesium.Viewer('cesiumContainer'); | ||
var scene = viewer.scene; | ||
var camera = scene.camera; | ||
|
||
var tileset = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({ | ||
url : 'https://beta.cesium.com/api/assets/1458?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIxYmJiNTAxOC1lOTg5LTQzN2EtODg1OC0zMWJjM2IxNGNlYmMiLCJpZCI6NDQsImFzc2V0cyI6WzE0NThdLCJpYXQiOjE0OTkyNjM4MjB9.1WKijRa-ILkmG6utrhDWX6rDgasjD7dZv-G5ZyCmkKg' | ||
})); | ||
|
||
tileset.readyPromise.then(function() { | ||
var boundingSphere = tileset.boundingSphere; | ||
camera.viewBoundingSphere(boundingSphere, new Cesium.HeadingPitchRange(0.0, -0.5, boundingSphere.radius)); | ||
camera.lookAtTransform(Cesium.Matrix4.IDENTITY); | ||
|
||
var dimensions = new Cesium.Cartesian3(40.0, 30.0, 50.0); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we use a slightly different geometry that shows how this is different than a |
||
var boxModelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(boundingSphere.center); | ||
var boxGeometry = Cesium.BoxGeometry.fromDimensions({ | ||
vertexFormat : Cesium.PerInstanceColorAppearance.VERTEX_FORMAT, | ||
dimensions : dimensions | ||
}); | ||
var boxGeometryInstance = new Cesium.GeometryInstance({ | ||
geometry : boxGeometry, | ||
modelMatrix : boxModelMatrix, | ||
attributes : { | ||
color : Cesium.ColorGeometryInstanceAttribute.fromColor(new Cesium.Color(1.0, 0.0, 0.0, 0.5)) | ||
}, | ||
id : 'box volume' | ||
}); | ||
scene.primitives.add(new Cesium.ClassificationPrimitive({ | ||
geometryInstances : boxGeometryInstance | ||
})); | ||
}).otherwise(function(error) { | ||
throw(error); | ||
}); | ||
|
||
var currentObjectId; | ||
var currentPrimitive; | ||
|
||
var handler = new Cesium.ScreenSpaceEventHandler(scene.canvas); | ||
handler.setInputAction(function(movement) { | ||
var pickedObject = scene.pick(movement.endPosition); | ||
if (Cesium.defined(pickedObject) && Cesium.defined(pickedObject.primitive) && Cesium.defined(pickedObject.id) && Cesium.defined(pickedObject.primitive.getGeometryInstanceAttributes)) { | ||
currentObjectId = pickedObject.id; | ||
currentPrimitive = pickedObject.primitive; | ||
currentPrimitive.getGeometryInstanceAttributes(currentObjectId).color = [255, 0, 255, 128]; | ||
} else if (Cesium.defined(currentObjectId)) { | ||
currentPrimitive.getGeometryInstanceAttributes(currentObjectId).color = [255, 0, 0, 128]; | ||
currentObjectId = undefined; | ||
currentPrimitive = undefined; | ||
} | ||
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE); | ||
//Sandcastle_End | ||
Sandcastle.finishedLoading(); | ||
} | ||
if (typeof Cesium !== "undefined") { | ||
startup(Cesium); | ||
} else if (typeof require === "function") { | ||
require(["Cesium"], startup); | ||
} | ||
</script> | ||
</body> | ||
</html> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure this should go under
Development
? I would rather it be more prominent.