text
stringlengths 2
1.05M
|
|---|
require('babel-register');
require('babel-polyfill');
module.exports = {
networks: {
development: {
host: "127.0.0.1",
port: 8545,
network_id: "*" // Match any network id
},
},
contracts_directory: './src/contracts/',
contracts_build_directory: './src/abis/',
compilers: {
solc: {
optimizer: {
enabled: true,
runs: 200
},
evmVersion: "petersburg"
}
}
}
|
module.exports = {
displayName: 'ui-localization',
preset: '../../../jest.preset.js',
transform: {
'^.+\\.[tj]sx?$': 'babel-jest',
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageDirectory: '../../../coverage/libs/ui/localization',
};
|
"use strict";function modifierStateGetter(t){var e=this,r=e.nativeEvent;if(r.getModifierState){return r.getModifierState(t)}var i=modifierKeyToProp[t];return!!i&&!!r[i]}function getEventModifierState(t){return modifierStateGetter}var modifierKeyToProp={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};module.exports=getEventModifierState;
|
/*
Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
CKEDITOR.plugins.setLang( 'contextmenu', 'fo', {
options: 'Context Menu Options'
} );
|
var searchData=
[
['transform_5ffunctions_2eh',['transform_functions.h',['../transform__functions_8h.html',1,'']]],
['transform_5ffunctions_5ff16_2eh',['transform_functions_f16.h',['../transform__functions__f16_8h.html',1,'']]],
['transformfunctions_2ec',['TransformFunctions.c',['../TransformFunctions_8c.html',1,'']]],
['transformfunctionsf16_2ec',['TransformFunctionsF16.c',['../TransformFunctionsF16_8c.html',1,'']]]
];
|
const packageNames = require('./build/getPackageNames').getPackageNames();
const PATH = {
npm: '@semantic-release/npm',
gh: '@semantic-release/github',
exec: '@semantic-release/exec',
git: '@semantic-release/git'
};
exports.branch = 'master';
exports.tagFormat = '${version}';
exports.generateNotes = {config: '@alorel-personal/conventional-changelog-alorel'};
exports.verifyConditions = [
{path: PATH.npm, pkgRoot: '.'},
PATH.gh
];
exports.prepare = [
'@semantic-release/changelog',
PATH.npm,
{path: PATH.exec, cmd: 'yarn run sync'},
{path: PATH.exec, cmd: 'yarn run clean'},
{path: PATH.exec, cmd: 'yarn run build'},
{path: PATH.exec, cmd: 'yarn run copy'},
...packageNames.map(pkg => ({
path: PATH.exec,
cmd: `bash -c "cd dist/${pkg} && yarn pack -o dist.tgz"`
})),
{
path: PATH.git,
message: 'chore(release): ${nextRelease.version}',
assets: [
'CHANGELOG.md',
'README.md',
'package.json',
'yarn.lock',
...packageNames.flatMap(pkg => [`packages/${pkg}/README.md`, `packages/${pkg}/package.json`])
]
}
];
exports.publish = [
...packageNames.map(pkg => ({
path: PATH.exec,
cmd: `bash -c "cd dist/${pkg} && npm publish dist.tgz"`
})),
PATH.gh
];
|
function printFibo(n, a, b) {
if (n === 0) return "";
if(n===1) {
console.log(`${a}`)
} else if(n ===2) {
console.log(`${a}, ${b}`);
} else {
let seq = `${a}, ${b}`;
let nextA = a;
let nextB = b;
for(let i=0; i<n-2; i++) {
let nextVal = nextA + nextB;
nextA = nextB;
nextB = nextVal;
seq += `, ${nextVal}`;
}
console.log(seq);
}
}
printFibo(20,12,1);
|
/**
* @author: Dennis Hern?ndez
* @webSite: http://djhvscf.github.io/Blog
* @version: v1.0.0
*/
(function ($) {
'use strict';
var initResizable = function (that) {
//Deletes the plugin to re-create it
that.$el.colResizable({disable: true});
//Creates the plugin
that.$el.colResizable({
liveDrag: that.options.liveDrag,
fixed: that.options.fixed,
headerOnly: that.options.headerOnly,
minWidth: that.options.minWidth,
hoverCursor: that.options.hoverCursor,
dragCursor: that.options.dragCursor,
onResize: that.onResize,
onDrag: that.options.onResizableDrag
});
};
$.extend($.fn.bootstrapTable.defaults, {
resizable: false,
liveDrag: false,
fixed: true,
headerOnly: false,
minWidth: 15,
hoverCursor: 'e-resize',
dragCursor: 'e-resize',
onResizableResize: function (e) {
return false;
},
onResizableDrag: function (e) {
return false;
}
});
var BootstrapTable = $.fn.bootstrapTable.Constructor,
_toggleView = BootstrapTable.prototype.toggleView,
_resetView = BootstrapTable.prototype.resetView;
BootstrapTable.prototype.toggleView = function () {
_toggleView.apply(this, Array.prototype.slice.apply(arguments));
if (this.options.resizable && this.options.cardView) {
//Deletes the plugin
$(this.$el).colResizable({disable: true});
}
};
BootstrapTable.prototype.resetView = function () {
var that = this;
_resetView.apply(this, Array.prototype.slice.apply(arguments));
if (this.options.resizable) {
// because in fitHeader function, we use setTimeout(func, 100);
setTimeout(function () {
initResizable(that);
}, 100);
}
};
BootstrapTable.prototype.onResize = function (e) {
var that = $(e.currentTarget);
that.bootstrapTable('resetView');
that.data('bootstrap.table').options.onResizableResize.apply(e);
}
})(jQuery);
|
import Axios from "axios";
import * as Types from "../types/Types";
import { message } from "antd";
const {REACT_APP_API}= process.env
export const shareNote=(data)=>async(dispatch)=>{
console.log(localStorage.auth_token)
try{
const Note = await Axios.post(`${REACT_APP_API}/note/share`,data,{
headers:{
'Content-Type': 'application/json',
"X-Jwt-Token": "Bearer " + localStorage.auth_token,
}
})
if(Note){
dispatch({
type: Types.SHARE_NOTE,
payload: {
shareNote: Note.data,
},
})
message.success(`Note has been Share to ${data.shared_to}`)
return true;
}
}
catch(error){
console.log(error.data)
message.error("Already Shared with the user")
return false;
}
};
export const getSharedNotes=()=>async(dispatch)=>{
console.log(localStorage.auth_token)
try{
const Note = await Axios.get(`${REACT_APP_API}/note/share`,{
headers:{
'Content-Type': 'application/json',
"X-Jwt-Token": "Bearer " + localStorage.auth_token,
}
})
if(Note){
dispatch({
type: Types.GET_SHARED_NOTES,
payload: {
sharedNotes: Note.data,
},
})
return true;
}
}
catch(error){
console.log(error.data)
return false;
}
};
export const getSharedUsers=()=>async(dispatch)=>{
console.log(localStorage.auth_token)
try{
const Users = await Axios.get(`${REACT_APP_API}/note/user/shared-by-me`,{
headers:{
'Content-Type': 'application/json',
"X-Jwt-Token": "Bearer " + localStorage.auth_token,
}
})
if(Users){
dispatch({
type: Types.GET_SHARED_USERS,
payload: {
sharedUser: Users.data,
},
})
return true;
}
}
catch(error){
console.log(error.data)
return false;
}
}
|
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*
* Version: 5.1.1 (2019-10-28)
*/
(function (domGlobals) {
'use strict';
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
function Plugin () {
global.add('colorpicker', function () {
domGlobals.console.warn('Color picker plugin is now built in to the core editor, please remove it from your editor configuration');
});
}
Plugin();
}(window));
|
// ==========================================================================
// Fetch wrapper
// ==========================================================================
export default function fetch(url, responseType = 'text') {
return new Promise((resolve, reject) => {
try {
const request = new XMLHttpRequest();
// Check for CORS support
if (!('withCredentials' in request)) {
return;
}
request.addEventListener('load', () => {
if (responseType === 'text') {
try {
resolve(JSON.parse(request.responseText));
} catch (e) {
resolve(request.responseText);
}
} else {
resolve(request.response);
}
});
request.addEventListener('error', () => {
throw new Error(request.status);
});
request.open('GET', url, true);
// Set the required response type
request.responseType = responseType;
request.send();
} catch (e) {
reject(e);
}
});
}
|
const path = require('path');
const Webpack = require('webpack');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const ImageminWebpackPlugin = require('imagemin-webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
let config = {
entry: {
main: path.resolve('./index.js')
},
output: {
filename: 'script/[name].[chunkhash:8].js',
chunkFilename: 'script/[name].[chunkhash:8].js',
path: path.resolve('dist'),
publicPath: '/'
},
resolve: {
extensions: ['.js', '.jsx', '.json'],
alias: {
'@PUBLIC': path.resolve('public')
}
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: path.resolve('node_modules'),
use: [
'babel-loader',
'./loader/react-img-src-loader'
]
},
{
test: /^(.{0,6}|.*(?!\.external).{2}(?!\.module).{7})\.(css|scss)$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
'postcss-loader',
'sass-loader',
{
loader: 'sass-resources-loader',
options: {
resources: [
path.resolve('public/style/variable.scss'),
path.resolve('public/style/placeholder.scss'),
path.resolve('public/style/mixin.scss')
]
}
}
]
},
{
test: /module\.(css|scss)$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: {
modules: true
}
},
'postcss-loader',
'sass-loader',
{
loader: 'sass-resources-loader',
options: {
resources: [
path.resolve('public/style/variable.scss'),
path.resolve('public/style/placeholder.scss'),
path.resolve('public/style/mixin.scss')
]
}
}
]
},
{
test: /external\.(css|scss)$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
'postcss-loader',
'sass-loader'
]
},
{
test: /\.(html|htm)$/,
loader: 'html-withimg-loader'
},
{
test: /\.svg$/,
include: /[\\/]icon[\\/]/,
loader: 'svg-sprite-loader',
options: {
symbolId: 'icon-[name]'
}
},
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
exclude: /[\\/](icon|font)[\\/]/,
loader: 'url-loader',
options: {
limit: 8192,
name: '[name].[hash:7].[ext]',
outputPath: 'image'
}
},
{
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 8192,
name: '[name].[hash:7].[ext]',
outputPath: 'media'
}
},
{
test: /\.(woff2?|eot|ttf|otf|svg)(\?.*)?$/,
include: /[\\/]font[\\/]/,
loader: 'url-loader',
options: {
limit: 8192,
name: '[name].[ext]',
outputPath: 'font'
}
}
]
},
plugins: [
new Webpack.ProvidePlugin({
React: 'react',
Component: ['react', 'Component'],
Lazy: ['react', 'lazy'],
Suspense: ['react', 'Suspense'],
Link: ['react-router-dom', 'Link'],
withRouter: ['react-router-dom', 'withRouter'],
Loadable: 'react-loadable',
$: 'jquery',
jQuery: 'jquery',
Fetch: ['@PUBLIC/script/fetch', 'default'],
Nothing: ['@PUBLIC/component/nothing', 'default']
}),
new MiniCssExtractPlugin({
filename: 'style/[name].[contenthash:8].css',
chunkFilename: 'style/[name].[contenthash:8].css'
}),
new ImageminWebpackPlugin({
bail: false,
cache: false,
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
exclude: /[\\/](icon|font)[\\/]/,
imageminOptions: {
plugins: [
'optipng',
['jpegtran', { progressive: true }],
['gifsicle', { interlaced: true }],
'svgo'
]
}
}),
new HtmlWebpackPlugin({
title: 'Demo',
filename: 'index.html',
template: path.resolve('./index.html'),
favicon: path.resolve('public/favicon.ico'),
chunks: ['manifest', 'vendor', 'main'],
chunksSortMode: 'none'
}),
new CopyWebpackPlugin([
{
from: path.resolve('index'),
to: '',
ignore: ['.*']
},
{
from: path.resolve('error'),
to: 'error',
ignore: ['.*']
},
{
from: './**/*.external.js',
to: 'script',
ignore: ['.*'],
flatten: true
},
{
from: './**/*.external.css',
to: 'style',
ignore: ['.*'],
flatten: true
}
])
],
optimization: {
splitChunks: {
chunks: 'all',
cacheGroups: {
vendor: {
name: 'vendor',
test: /[\\/]node_modules[\\/]/,
priority: 0,
enforce: true,
chunks: chunk => chunk.name === 'main'
}
}
},
runtimeChunk: {
name: 'manifest'
},
minimizer: [
new TerserPlugin({
terserOptions: {
mangle: true
},
sourceMap: false,
cache: true,
parallel: true
})
]
}
};
module.exports = (env, argv) => {
if (argv.mode === 'production') {
config.plugins.unshift(new CleanWebpackPlugin());
}
if (argv.mode === 'development') {
config.output.filename = 'script/[name].js';
config.output.chunkFilename = 'script/[name].js';
config.plugins.push(new Webpack.HotModuleReplacementPlugin());
config.devServer = {
contentBase: path.resolve('index'),
historyApiFallback: {
rewrites: [
{ from: /^\/?$/, to: '/index.html' },
{ from: /^\/error\/4\d{2}$/, to: '/error/4xx.html' },
{ from: /^\/error\/5\d{2}$/, to: '/error/5xx.html' },
{ from: /^.+$/, to: '/error/4xx.html' }
]
},
hot: true,
index: 'index.html',
overlay: {
warnings: false,
errors: true
},
open: false,
port: 3000,
proxy: {
'/api/': {
'target': 'http://localhost:3030',
'changeOrigin': true,
'pathRewrite': {
'^/api': ''
}
}
}
};
}
return config;
};
|
import { extendTheme } from "@chakra-ui/react";
const config = {
initialColorMode: "dark",
useSystemColorMode: false,
};
const theme = extendTheme({
config,
colors: {
purple: {
50: "#EEE6FE",
100: "#CFBAFC",
200: "#B18EFB",
300: "#9262F9",
400: "#7436F7",
500: "#5509F6",
600: "#4408C4",
700: "#330693",
800: "#220462",
900: "#110231",
},
blue: {
50: "#E7EDFE",
100: "#BCCBFB",
200: "#91AAF8",
300: "#6589F5",
400: "#3A68F3",
500: "#0F47F0",
600: "#0C39C0",
700: "#092A90",
800: "#061C60",
900: "#030E30",
},
pink: {
50: "#FCE9F6",
100: "#F5C1E7",
200: "#EF99D7",
300: "#E972C8",
400: "#E34AB8",
500: "#DD22A9",
600: "#B11B87",
700: "#851465",
800: "#580E44",
900: "#2C0722",
},
"green": {
"50": "#ECF8F6",
"100": "#CBECE5",
"200": "#AADFD5",
"300": "#88D3C4",
"400": "#67C6B4",
"500": "#45BAA3",
"600": "#389482",
"700": "#2A6F62",
"800": "#1C4A41",
"900": "#0E2521"
},
yellow: {
50: "#FEFBE7",
100: "#FBF3BC",
200: "#F9EB90",
300: "#F6E365",
400: "#F3DB39",
500: "#F1D30E",
600: "#C1A80B",
700: "#917E08",
800: "#605406",
900: "#302A03",
},
orange: {
50: "#FEF0E6",
100: "#FCD5BA",
200: "#FBB98E",
300: "#F99E62",
400: "#F88335",
500: "#F66809",
600: "#C55307",
700: "#943E05",
800: "#622A04",
900: "#311502",
},
red: {
50: "#FBEAEE",
100: "#F3C3D0",
200: "#EB9DB2",
300: "#E47794",
400: "#DC5176",
500: "#D52A58",
600: "#AA2246",
700: "#801935",
800: "#551123",
900: "#2B0812",
}
},
});
export default theme;
|
module.exports={A:{A:{"2":"O D G E A B mB"},B:{"2":"C I F P J K L Y","450":"KB M N S T YB V"},C:{"2":"0 1 2 3 4 5 6 7 8 9 kB bB H Z O D G E A B C I F P J K L a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB QB HB IB JB R LB MB NB OB GB X W VB RB SB TB UB PB Y KB M lB N S T tB wB"},D:{"2":"0 1 2 3 4 5 6 7 8 9 H Z O D G E A B C I F P J K L a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB QB HB IB JB R LB MB NB OB GB X W VB RB SB TB UB PB Y","450":"KB M N S T YB V xB cB dB"},E:{"2":"H Z O D G E A B C I F eB WB gB hB iB jB XB U Q nB oB"},F:{"2":"0 1 2 3 4 5 6 7 8 9 E B C P J K L a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB FB HB IB JB R LB pB qB rB sB U ZB uB Q","450":"MB NB OB GB X W"},G:{"2":"G F WB vB aB UC yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC"},H:{"2":"DC"},I:{"2":"bB H M EC FC GC HC aB IC JC"},J:{"2":"D A"},K:{"2":"A B C EB U ZB Q"},L:{"450":"V"},M:{"2":"N"},N:{"2":"A B"},O:{"2":"KC"},P:{"2":"H LC MC NC OC PC XB QC RC"},Q:{"2":"SC"},R:{"2":"TC"},S:{"2":"fB"}},B:7,C:"Web NFC"};
|
'use strict';
module.exports = function isArrayish(obj) {
if (!obj) {
return false;
}
return obj instanceof Array || Array.isArray(obj) ||
(obj.length >= 0 && obj.splice instanceof Function);
};
|
// This file was procedurally generated from the following sources:
// - src/class-fields/static-private-methods.case
// - src/class-fields/productions/cls-expr-after-same-line-async-gen.template
/*---
description: static private methods (field definitions after an async generator in the same line)
esid: prod-FieldDefinition
features: [class-static-methods-private, class, class-fields-public, async-iteration]
flags: [generated, async]
includes: [propertyHelper.js]
info: |
ClassElement :
...
static FieldDefinition ;
FieldDefinition :
ClassElementName Initializer_opt
ClassElementName :
PrivateName
PrivateName :
# IdentifierName
---*/
var C = class {
async *m() { return 42; } ;
static #x(value) {
return value / 2;
}
static #y(value) {
return value * 2;
}
static x() {
return this.#x(84);
}
static y() {
return this.#y(43);
}
}
var c = new C();
assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
assert.sameValue(c.m, C.prototype.m);
verifyProperty(C.prototype, "m", {
enumerable: false,
configurable: true,
writable: true,
}, {restore: true});
c.m().next().then(function(v) {
assert.sameValue(v.value, 42);
assert.sameValue(v.done, true);
function assertions() {
// Cover $DONE handler for async cases.
function $DONE(error) {
if (error) {
throw new Test262Error('Test262:AsyncTestFailure')
}
}
// Test the private methods do not appear as properties before set to value
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1");
assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2");
assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3");
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4");
assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5");
assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6");
// Test if private fields can be sucessfully accessed and set to value
assert.sameValue(C.x(), 42, "test 7");
assert.sameValue(C.y(), 86, "test 8");
// Test the private fields do not appear as properties before after set to value
assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9");
assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10");
}
return Promise.resolve(assertions());
}, $DONE).then($DONE, $DONE);
|
!function(){function getStyles(config){ return "<style>"+config.selector+"{width:90px;height:20px}"+config.selector+" [class*=entypo-]:before{font-family:entypo,sans-serif}"+config.selector+" label{font-size:16px;cursor:pointer;margin:0;padding:5px 10px;border-radius:5px;background:"+config.button_background+";color:"+config.button_color+";-webkit-transition:all .3s ease;transition:all .3s ease}"+config.selector+" label:hover{opacity:.8}"+config.selector+" label span{text-transform:uppercase;font-size:.9em;font-family:Lato,sans-serif;font-weight:700;-webkit-font-smoothing:antialiased;padding-left:6px}"+config.selector+" .social{-webkit-transform-origin:50% 0;-ms-transform-origin:50% 0;transform-origin:50% 0;-webkit-transform:scale(0) translateY(-190px);-ms-transform:scale(0) translateY(-190px);transform:scale(0) translateY(-190px);opacity:0;-webkit-transition:all .4s ease;transition:all .4s ease;margin-left:-15px}"+config.selector+" .social.active{opacity:1;-webkit-transition:all .4s ease;transition:all .4s ease}"+config.selector+" .social.active.center{margin-left:-45px}"+config.selector+" .social.active.left{margin-left:-115px}"+config.selector+" .social.active.right{margin-left:10px}"+config.selector+" .social.active.top{-webkit-transform:scale(1) translateY(-90px);-ms-transform:scale(1) translateY(-90px);transform:scale(1) translateY(-90px)}"+config.selector+" .social.active.top.center ul:after{margin:35px auto;border-top:20px solid #3b5998}"+config.selector+" .social.active.top.left ul:after{margin:35px 0 0 129px;border-top:20px solid #e34429}"+config.selector+" .social.active.top.right ul:after{margin:35px 0 0 10px;border-top:20px solid #6cdfea}"+config.selector+" .social.active.bottom{-webkit-transform:scale(1) translateY(45px);-ms-transform:scale(1) translateY(45px);transform:scale(1) translateY(45px);margin-top:-14px}"+config.selector+" .social.active.bottom.center ul:after{margin:-10px auto;border-bottom:20px solid #3b5998}"+config.selector+" .social.active.bottom.left ul:after{margin:-10px 0 0 129px;border-bottom:20px solid #e34429}"+config.selector+" .social.active.bottom.right ul:after{margin:-10px 0 0 10px;border-bottom:20px solid #6cdfea}"+config.selector+" .social ul{position:relative;left:0;right:0;width:180px;height:46px;color:#fff;background:#3b5998;margin:auto;padding:0;list-style:none}"+config.selector+" .social ul li{font-size:20px;cursor:pointer;width:60px;margin:0;padding:12px 0;text-align:center;float:left;display:block;height:22px;position:relative;z-index:2;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;-webkit-transition:all .3s ease;transition:all .3s ease}"+config.selector+" .social ul li:hover{color:rgba(0,0,0,.5)}"+config.selector+" .social ul:after{content:'';display:block;width:0;height:0;position:absolute;left:0;right:0;border-left:20px solid transparent;border-right:20px solid transparent}"+config.selector+" .social li[class*=twitter]{background:#6cdfea;padding:12px 0}"+config.selector+" .social li[class*=gplus]{background:#e34429;padding:12px 0}</style>"};var $;$=jQuery,$.fn.share=function(t){var e,o;return 0===$(this).length?(console.log("Share Button: No elements found."),void 0):(o=$("head"),e=$("body"),$(this).each(function(o){var n,i,a,r,l,s,c,p,d,f,u;return n=$(this),n.addClass("sharer-"+o),n.hide(),null==t&&(t={}),s={},s.url=t.url||window.location.href,s.text=t.text||$('meta[property="og:description"]').attr("content")||$('meta[name="twitter:description"]').attr("content")||$('meta[name="description"]').attr("content")||"",s.title=t.title||$('meta[property="og:title"]').attr("content")||$('meta[name="twitter:title"]').attr("content"),s.image=t.image||$('meta[property="og:image"]').attr("content")||$('meta[name="twitter:image"]').attr("content"),s.app_id=t.app_id,s.flyout=t.flyout||"top center",s.text_font="boolean"==typeof t.text_font?t.text_font:!0,s.button_color=t.color||"#333",s.button_background=t.background||"#e1e1e1",s.button_icon=t.icon||"export",s.button_text="string"==typeof t.button_text?t.button_text:"Share",f=function(e,o){return t[e]?t[e][o]||s[o]:s[o]},s.twitter_url=f("twitter","url"),s.twitter_text=f("twitter","text"),s.fb_url=f("facebook","url"),s.fb_title=f("facebook","title"),s.fb_caption=f("facebook","caption"),s.fb_text=f("facebook","text"),s.fb_image=f("facebook","image"),s.gplus_url=f("gplus","url"),s.selector="."+n.attr("class").split(" ").join("."),s.twitter_text=encodeURIComponent(s.twitter_text),"integer"==typeof s.app_id&&(s.app_id=s.app_id.toString()),s.protocol=t.protocol||(-1===["http","https"].indexOf(window.location.href.split(":")[0])?"https://":"//"),$('link[href="https://www.sharebutton.co/fonts/v2/entypo.min.css"]').length||$("<link />").attr({rel:"stylesheet",href:"https://www.sharebutton.co/fonts/v2/entypo.min.css"}).appendTo($("head")),$("meta[name='sharer"+s.selector+"']").length||$("head").append(getStyles(s)).append("<meta name='sharer"+s.selector+"'>"),s.text_font&&($('link[href="'+s.protocol+'fonts.googleapis.com/css?family=Lato:900"]').length||$("<link />").attr({rel:"stylesheet",href:""+s.protocol+"fonts.googleapis.com/css?family=Lato:900&text="+s.button_text}).appendTo($("head"))),$(this).html("<label class='entypo-"+s.button_icon+"'><span>"+s.button_text+"</span></label><div class='social "+s.flyout+"'><ul><li class='entypo-twitter' data-network='twitter'></li><li class='entypo-facebook' data-network='facebook'></li><li class='entypo-gplus' data-network='gplus'></li></ul></div>"),!window.FB&&s.app_id&&0===$("#fb-root").length&&e.append("<div id='fb-root'></div><script>(function(a,b,c){var d,e=a.getElementsByTagName(b)[0];a.getElementById(c)||(d=a.createElement(b),d.id=c,d.src='"+s.protocol+"connect.facebook.net/en_US/all.js#xfbml=1&appId="+s.app_id+"',e.parentNode.insertBefore(d,e))})(document,'script','facebook-jssdk');</script>"),d={twitter:"http://twitter.com/intent/tweet?text="+s.twitter_text+"&url="+s.twitter_url,facebook:"https://www.facebook.com/sharer/sharer.php?u="+s.fb_url,gplus:"https://plus.google.com/share?url="+s.gplus_url},p=n.parent(),a=p.find(".social"),i=p.find(""+s.selector+" .social"),u=function(t){return t.stopPropagation(),i.toggleClass("active")},c=function(){return i.addClass("active")},l=function(){return i.removeClass("active")},r=function(){var t,e;if(t=d[$(this).data("network")],"facebook"===$(this).data("network")&&s.app_id){if(!window.FB)return console.log("The Facebook JS SDK hasn't loaded yet."),void 0;window.FB.ui({method:"feed",name:s.fb_title,link:s.fb_url,picture:s.fb_image,caption:s.fb_caption,description:s.fb_text})}else e={width:500,height:350},e.top=screen.height/2-e.height/2,e.left=screen.width/2-e.width/2,window.open(t,"targetWindow","toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,left="+e.left+",top="+e.top+",width="+e.width+",height="+e.height);return!1},n.find("label").on("click",u),n.find("li").on("click",r),e.on("click",function(){return a.removeClass("active")}),setTimeout(function(){return n.show()},250),{toggle:u.bind(this),open:c.bind(this),close:l.bind(this),options:s,self:this}}))};}.call(this)
|
/**
Custom Routes
=============
You can create your own routing here.
This is prioritized over automatic controller routing.
**/
var routes = {
/** Example:
'/test' : function(req, res, next) { res.end('Hello World')}, //defaults to all GET, POST, DELETE, etc
'/sample' : {
//more specific
get: function(req, res, next) {
res.end('Hello Sample Get');
},
post: function(req, res, next) {
res.end('Hello Sample Post');
},
onError: function(req, res, err, app) {
//optional error handling
}
},
'/controller-sample' : web.include('/web/src/controllers/index.js'),
// sample regex
'/^((?!\/static).)*$/' : {
isRegexp: true,
all: function(req, res, next) {
//do stuff here like authentication
next();
}
}
*/
}
module.exports = routes;
|
var t=Object.defineProperty,e=Object.defineProperties,r=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,o=(e,r,s)=>r in e?t(e,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[r]=s,i=(t,e)=>{for(var r in e||(e={}))a.call(e,r)&&o(t,r,e[r]);if(s)for(var r of s(e))n.call(e,r)&&o(t,r,e[r]);return t};import{S as l,i as c,s as u,e as h,c as d,a as p,d as f,b as g,f as m,t as _,g as y,h as v,j as b,k as $,l as w,m as E,n as x,o as R,p as q,q as L,r as O,u as S,v as P,w as j,x as k,y as A,z as T,A as U,B as I,C as D}from"./chunks/vendor-5cf7a4b5.js";function V(t){let e,r,s;const a=[t[2]||{}];var n=t[0][1];function o(t){let e={$$slots:{default:[C]},$$scope:{ctx:t}};for(let r=0;r<a.length;r+=1)e=U(e,a[r]);return{props:e}}return n&&(e=new n(o(t))),{c(){e&&b(e.$$.fragment),r=w()},l(t){e&&E(e.$$.fragment,t),r=w()},m(t,a){e&&R(e,t,a),m(t,r,a),s=!0},p(t,s){const i=4&s?q(a,[L(t[2]||{})]):{};if(521&s&&(i.$$scope={dirty:s,ctx:t}),n!==(n=t[0][1])){if(e){I();const t=e;O(t.$$.fragment,1,0,(()=>{j(t,1)})),S()}n?(e=new n(o(t)),b(e.$$.fragment),P(e.$$.fragment,1),R(e,r.parentNode,r)):e=null}else n&&e.$set(i)},i(t){s||(e&&P(e.$$.fragment,t),s=!0)},o(t){e&&O(e.$$.fragment,t),s=!1},d(t){t&&f(r),e&&j(e,t)}}}function N(t){let e,r,s;const a=[t[3]||{}];var n=t[0][2];function o(t){let e={};for(let r=0;r<a.length;r+=1)e=U(e,a[r]);return{props:e}}return n&&(e=new n(o())),{c(){e&&b(e.$$.fragment),r=w()},l(t){e&&E(e.$$.fragment,t),r=w()},m(t,a){e&&R(e,t,a),m(t,r,a),s=!0},p(t,s){const i=8&s?q(a,[L(t[3]||{})]):{};if(n!==(n=t[0][2])){if(e){I();const t=e;O(t.$$.fragment,1,0,(()=>{j(t,1)})),S()}n?(e=new n(o()),b(e.$$.fragment),P(e.$$.fragment,1),R(e,r.parentNode,r)):e=null}else n&&e.$set(i)},i(t){s||(e&&P(e.$$.fragment,t),s=!0)},o(t){e&&O(e.$$.fragment,t),s=!1},d(t){t&&f(r),e&&j(e,t)}}}function C(t){let e,r,s=t[0][2]&&N(t);return{c(){s&&s.c(),e=w()},l(t){s&&s.l(t),e=w()},m(t,a){s&&s.m(t,a),m(t,e,a),r=!0},p(t,r){t[0][2]?s?(s.p(t,r),1&r&&P(s,1)):(s=N(t),s.c(),P(s,1),s.m(e.parentNode,e)):s&&(I(),O(s,1,1,(()=>{s=null})),S())},i(t){r||(P(s),r=!0)},o(t){O(s),r=!1},d(t){s&&s.d(t),t&&f(e)}}}function B(t){let e,r,s=t[0][1]&&V(t);return{c(){s&&s.c(),e=w()},l(t){s&&s.l(t),e=w()},m(t,a){s&&s.m(t,a),m(t,e,a),r=!0},p(t,r){t[0][1]?s?(s.p(t,r),1&r&&P(s,1)):(s=V(t),s.c(),P(s,1),s.m(e.parentNode,e)):s&&(I(),O(s,1,1,(()=>{s=null})),S())},i(t){r||(P(s),r=!0)},o(t){O(s),r=!1},d(t){s&&s.d(t),t&&f(e)}}}function z(t){let e,r=t[5]&&K(t);return{c(){e=h("div"),r&&r.c(),this.h()},l(t){e=d(t,"DIV",{id:!0,"aria-live":!0,"aria-atomic":!0,class:!0});var s=p(e);r&&r.l(s),s.forEach(f),this.h()},h(){g(e,"id","svelte-announcer"),g(e,"aria-live","assertive"),g(e,"aria-atomic","true"),g(e,"class","svelte-1j55zn5")},m(t,s){m(t,e,s),r&&r.m(e,null)},p(t,s){t[5]?r?r.p(t,s):(r=K(t),r.c(),r.m(e,null)):r&&(r.d(1),r=null)},d(t){t&&f(e),r&&r.d()}}}function K(t){let e;return{c(){e=_(t[6])},l(r){e=y(r,t[6])},m(t,r){m(t,e,r)},p(t,r){64&r&&v(e,t[6])},d(t){t&&f(e)}}}function W(t){let e,r,s,a;const n=[t[1]||{}];var o=t[0][0];function i(t){let e={$$slots:{default:[B]},$$scope:{ctx:t}};for(let r=0;r<n.length;r+=1)e=U(e,n[r]);return{props:e}}o&&(e=new o(i(t)));let l=t[4]&&z(t);return{c(){e&&b(e.$$.fragment),r=$(),l&&l.c(),s=w()},l(t){e&&E(e.$$.fragment,t),r=x(t),l&&l.l(t),s=w()},m(t,n){e&&R(e,t,n),m(t,r,n),l&&l.m(t,n),m(t,s,n),a=!0},p(t,[a]){const c=2&a?q(n,[L(t[1]||{})]):{};if(525&a&&(c.$$scope={dirty:a,ctx:t}),o!==(o=t[0][0])){if(e){I();const t=e;O(t.$$.fragment,1,0,(()=>{j(t,1)})),S()}o?(e=new o(i(t)),b(e.$$.fragment),P(e.$$.fragment,1),R(e,r.parentNode,r)):e=null}else o&&e.$set(c);t[4]?l?l.p(t,a):(l=z(t),l.c(),l.m(s.parentNode,s)):l&&(l.d(1),l=null)},i(t){a||(e&&P(e.$$.fragment,t),a=!0)},o(t){e&&O(e.$$.fragment,t),a=!1},d(t){e&&j(e,t),t&&f(r),l&&l.d(t),t&&f(s)}}}function M(t,e,r){let{stores:s}=e,{page:a}=e,{components:n}=e,{props_0:o=null}=e,{props_1:i=null}=e,{props_2:l=null}=e;k("__svelte__",s),A(s.page.notify);let c=!1,u=!1,h=null;return T((()=>{const t=s.page.subscribe((()=>{c&&(r(5,u=!0),r(6,h=document.title||"untitled page"))}));return r(4,c=!0),t})),t.$$set=t=>{"stores"in t&&r(7,s=t.stores),"page"in t&&r(8,a=t.page),"components"in t&&r(0,n=t.components),"props_0"in t&&r(1,o=t.props_0),"props_1"in t&&r(2,i=t.props_1),"props_2"in t&&r(3,l=t.props_2)},t.$$.update=()=>{384&t.$$.dirty&&s.page.set(a)},[n,o,i,l,c,u,h,s,a]}class Y extends l{constructor(t){super(),c(this,t,M,W,u,{stores:7,page:8,components:0,props_0:1,props_1:2,props_2:3})}}let G;const J={},X=function(t,e){if(!e)return t();if(void 0===G){const t=document.createElement("link").relList;G=t&&t.supports&&t.supports("modulepreload")?"modulepreload":"preload"}return Promise.all(e.map((t=>{if(t in J)return;J[t]=!0;const e=t.endsWith(".css"),r=e?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${t}"]${r}`))return;const s=document.createElement("link");return s.rel=e?"stylesheet":G,e||(s.as="script",s.crossOrigin=""),s.href=t,document.head.appendChild(s),e?new Promise(((t,e)=>{s.addEventListener("load",t),s.addEventListener("error",e)})):void 0}))).then((()=>t()))},F=[()=>X((()=>import("./pages/__layout.svelte-d161c8ed.js")),["/_app/pages/__layout.svelte-d161c8ed.js","/_app/assets/pages/__layout.svelte-0566876a.css","/_app/chunks/vendor-5cf7a4b5.js"]),()=>X((()=>import("./error.svelte-220e8eb7.js")),["/_app/error.svelte-220e8eb7.js","/_app/chunks/vendor-5cf7a4b5.js"]),()=>X((()=>import("./pages/index.svelte-5f15937c.js")),["/_app/pages/index.svelte-5f15937c.js","/_app/assets/pages/index.svelte-3cb1802b.css","/_app/chunks/vendor-5cf7a4b5.js"]),()=>X((()=>import("./pages/configuration/index.svelte-ba2ac5a9.js")),["/_app/pages/configuration/index.svelte-ba2ac5a9.js","/_app/assets/pages/configuration/index.svelte-74ff4fc7.css","/_app/chunks/vendor-5cf7a4b5.js","/_app/chunks/requests-f597ce78.js","/_app/assets/requests-e0aa7dee.css","/_app/chunks/store-f8ef346b.js"]),()=>X((()=>import("./pages/containers/index.svelte-5b89242d.js")),["/_app/pages/containers/index.svelte-5b89242d.js","/_app/assets/pages/containers/index.svelte-bb96b678.css","/_app/chunks/vendor-5cf7a4b5.js","/_app/chunks/index-222bcf94.js","/_app/chunks/requests-f597ce78.js","/_app/assets/requests-e0aa7dee.css"]),()=>X((()=>import("./pages/simulation/index.svelte-1c513fcd.js")),["/_app/pages/simulation/index.svelte-1c513fcd.js","/_app/assets/pages/simulation/index.svelte-698cee65.css","/_app/chunks/vendor-5cf7a4b5.js","/_app/chunks/index-222bcf94.js","/_app/chunks/requests-f597ce78.js","/_app/assets/requests-e0aa7dee.css","/_app/chunks/store-f8ef346b.js"]),()=>X((()=>import("./pages/analyzers/index.svelte-b173803c.js")),["/_app/pages/analyzers/index.svelte-b173803c.js","/_app/chunks/vendor-5cf7a4b5.js"]),()=>X((()=>import("./pages/database/index.svelte-a7c549f8.js")),["/_app/pages/database/index.svelte-a7c549f8.js","/_app/assets/pages/database/index.svelte-56054c64.css","/_app/chunks/vendor-5cf7a4b5.js"]),()=>X((()=>import("./pages/recovery/index.svelte-820851d7.js")),["/_app/pages/recovery/index.svelte-820851d7.js","/_app/assets/pages/simulation/index.svelte-698cee65.css","/_app/chunks/vendor-5cf7a4b5.js","/_app/chunks/requests-f597ce78.js","/_app/assets/requests-e0aa7dee.css","/_app/chunks/index-222bcf94.js"]),()=>X((()=>import("./pages/response/index.svelte-57b3458d.js")),["/_app/pages/response/index.svelte-57b3458d.js","/_app/chunks/vendor-5cf7a4b5.js"]),()=>X((()=>import("./pages/docs.svelte-e39c1b4b.js")),["/_app/pages/docs.svelte-e39c1b4b.js","/_app/assets/pages/docs.svelte-fa4258b7.css","/_app/chunks/vendor-5cf7a4b5.js"])],H=[[/^\/$/,[F[0],F[2]],[F[1]]],[/^\/configuration\/?$/,[F[0],F[3]],[F[1]]],[/^\/containers\/?$/,[F[0],F[4]],[F[1]]],[/^\/simulation\/?$/,[F[0],F[5]],[F[1]]],[/^\/analyzers\/?$/,[F[0],F[6]],[F[1]]],[/^\/database\/?$/,[F[0],F[7]],[F[1]]],[/^\/recovery\/?$/,[F[0],F[8]],[F[1]]],[/^\/response\/?$/,[F[0],F[9]],[F[1]]],[/^\/docs\/?$/,[F[0],F[10]],[F[1]]]],Q=[F[0](),F[1]()];function Z(){return{x:pageXOffset,y:pageYOffset}}function tt(t){for(;t&&"A"!==t.nodeName.toUpperCase();)t=t.parentNode;return t}class et{constructor({base:t,routes:e,trailing_slash:r}){this.base=t,this.routes=e,this.trailing_slash=r}init(t){let s;this.renderer=t,t.router=this,this.enabled=!0,"scrollRestoration"in history&&(history.scrollRestoration="manual"),addEventListener("beforeunload",(()=>{history.scrollRestoration="auto"})),addEventListener("load",(()=>{history.scrollRestoration="manual"})),addEventListener("scroll",(()=>{clearTimeout(s),s=setTimeout((()=>{const t=(s=i({},history.state||{}),a={"sveltekit:scroll":Z()},e(s,r(a)));var s,a;history.replaceState(t,document.title,window.location.href)}),50)}));const a=t=>{const e=tt(t.target);e&&e.href&&e.hasAttribute("sveltekit:prefetch")&&this.prefetch(new URL(e.href))};let n;addEventListener("touchstart",a),addEventListener("mousemove",(t=>{clearTimeout(n),n=setTimeout((()=>{a(t)}),20)})),addEventListener("click",(t=>{var e;if(!this.enabled)return;if(t.button||1!==t.which)return;if(t.metaKey||t.ctrlKey||t.shiftKey||t.altKey)return;if(t.defaultPrevented)return;const r=tt(t.target);if(!r)return;if(!r.href)return;const s="object"==typeof r.href&&"SVGAnimatedString"===r.href.constructor.name,a=String(s?r.href.baseVal:r.href);if(a===location.href)return void(location.hash||t.preventDefault());const n=null==(e=r.getAttribute("rel"))?void 0:e.split(/\s+/);if(r.hasAttribute("download")||n&&n.includes("external"))return;if(s?r.target.baseVal:r.target)return;const o=new URL(a);if(!this.owns(o))return;const i=r.hasAttribute("sveltekit:noscroll");history.pushState({},"",o.href),this._navigate(o,i?Z():null,[],o.hash),t.preventDefault()})),addEventListener("popstate",(t=>{if(t.state&&this.enabled){const e=new URL(location.href);this._navigate(e,t.state["sveltekit:scroll"],[])}})),document.body.setAttribute("tabindex","-1"),history.replaceState(history.state||{},"",location.href)}owns(t){return t.origin===location.origin&&t.pathname.startsWith(this.base)}parse(t){if(this.owns(t)){const e=decodeURIComponent(t.pathname.slice(this.base.length)||"/"),r=this.routes.filter((([t])=>t.test(e))),s=new URLSearchParams(t.search);return{id:`${e}?${s}`,routes:r,path:e,query:s}}}async goto(t,{noscroll:e=!1,replaceState:r=!1}={},s){const a=new URL(t,function(t){let e=t.baseURI;if(!e){const r=t.getElementsByTagName("base");e=r.length?r[0].href:t.URL}return e}(document));return this.enabled&&this.owns(a)?(history[r?"replaceState":"pushState"]({},"",t),this._navigate(a,e?Z():null,s,a.hash)):(location.href=a.href,new Promise((()=>{})))}enable(){this.enabled=!0}disable(){this.enabled=!1}async prefetch(t){const e=this.parse(t);if(!e)throw new Error("Attempted to prefetch a URL that does not belong to this app");return this.renderer.load(e)}async _navigate(t,e,r,s){const a=this.parse(t);if(!a)throw new Error("Attempted to navigate to a URL that does not belong to this app");if("/"!==a.path){const t=a.path.endsWith("/");(t&&"never"===this.trailing_slash||!t&&"always"===this.trailing_slash&&!a.path.split("/").pop().includes("."))&&(a.path=t?a.path.slice(0,-1):a.path+"/",history.replaceState({},"",`${a.path}${location.search}`))}this.renderer.notify({path:a.path,query:a.query}),await this.renderer.update(a,r,!1),document.body.focus();const n=s&&document.getElementById(s.slice(1));e?scrollTo(e.x,e.y):n?scrollTo(0,n.getBoundingClientRect().top+scrollY):scrollTo(0,0)}}function rt(t){const e=D(t);let r=!0;return{notify:function(){r=!0,e.update((t=>t))},set:function(t){r=!1,e.set(t)},subscribe:function(t){let s;return e.subscribe((e=>{(void 0===s||r&&e!==s)&&t(s=e)}))}}}function st(t,e){let r=`script[type="svelte-data"][url="${"string"==typeof t?t:t.url}"]`;e&&"string"==typeof e.body&&(r+=`[body="${function(t){let e=5381,r=t.length;if("string"==typeof t)for(;r;)e=33*e^t.charCodeAt(--r);else for(;r;)e=33*e^t[--r];return(e>>>0).toString(36)}(e.body)}"]`);const o=document.querySelector(r);if(o){const t=JSON.parse(o.textContent),{body:e}=t,r=((t,e)=>{var r={};for(var o in t)a.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(null!=t&&s)for(var o of s(t))e.indexOf(o)<0&&n.call(t,o)&&(r[o]=t[o]);return r})(t,["body"]);return Promise.resolve(new Response(e,r))}return fetch(t,e)}class at{constructor({Root:t,fallback:e,target:r,session:s,host:a}){this.Root=t,this.fallback=e,this.host=a,this.router=null,this.target=r,this.started=!1,this.session_id=1,this.invalid=new Set,this.invalidating=null,this.current={page:null,session_id:null,branch:[]},this.cache=new Map,this.loading={id:null,promise:null},this.stores={page:rt({}),navigating:D(null),session:D(s)},this.$session=null,this.root=null;let n=!1;this.stores.session.subscribe((async t=>{if(this.$session=t,!n)return;this.session_id+=1;const e=this.router.parse(new URL(location.href));this.update(e,[],!0)})),n=!0}async start({status:t,error:e,nodes:r,page:s}){const a=[];let n,o,l,c={};try{for(let n=0;n<r.length;n+=1){const u=n===r.length-1,h=await this._load_node({module:await r[n],page:s,context:c,status:u&&t,error:u&&e});if(a.push(h),h&&h.loaded)if(h.loaded.error){if(e)throw h.loaded.error;o=h.loaded.status,l=h.loaded.error}else h.loaded.context&&(c=i(i({},c),h.loaded.context))}n=await this._get_navigation_result_from_branch({page:s,branch:a})}catch(u){if(e)throw u;o=500,l=u}l&&(n=await this._load_error({status:o,error:l,path:s.path,query:s.query})),n.redirect?location.href=new URL(n.redirect,location.href).href:this._init(n)}notify({path:t,query:e}){dispatchEvent(new CustomEvent("sveltekit:navigation-start")),this.started&&this.stores.navigating.set({from:{path:this.current.page.path,query:this.current.page.query},to:{path:t,query:e}})}async update(t,e,r){const s=this.token={};let a=await this._get_navigation_result(t,r);if(s!==this.token)return;if(this.invalid.clear(),a.redirect){if(!(e.length>10||e.includes(t.path)))return void(this.router?this.router.goto(a.redirect,{replaceState:!0},[...e,t.path]):location.href=new URL(a.redirect,location.href).href);a=await this._load_error({status:500,error:new Error("Redirect loop"),path:t.path,query:t.query})}a.reload?location.reload():this.started?(this.current=a.state,this.root.$set(a.props),this.stores.navigating.set(null),await 0):this._init(a),dispatchEvent(new CustomEvent("sveltekit:navigation-end")),this.loading.promise=null,this.loading.id=null;const n=a.state.branch[a.state.branch.length-1];n&&!1===n.module.router?this.router.disable():this.router.enable()}load(t){return this.loading.promise=this._get_navigation_result(t,!1),this.loading.id=t.id,this.loading.promise}invalidate(t){return this.invalid.add(t),this.invalidating||(this.invalidating=Promise.resolve().then((async()=>{const t=this.router.parse(new URL(location.href));await this.update(t,[],!0),this.invalidating=null}))),this.invalidating}_init(t){this.current=t.state;const e=document.querySelector("style[data-svelte]");e&&e.remove(),this.root=new this.Root({target:this.target,props:i({stores:this.stores},t.props),hydrate:!0}),this.started=!0}async _get_navigation_result(t,e){if(this.loading.id===t.id)return this.loading.promise;for(let r=0;r<t.routes.length;r+=1){const s=t.routes[r];if(1===s.length)return{reload:!0};let a=r+1;for(;a<t.routes.length;){const e=t.routes[a];if(e[0].toString()!==s[0].toString())break;1!==e.length&&e[1].forEach((t=>t())),a+=1}const n=await this._load({route:s,path:t.path,query:t.query},e);if(n)return n}return await this._load_error({status:404,error:new Error(`Not found: ${t.path}`),path:t.path,query:t.query})}async _get_navigation_result_from_branch({page:t,branch:e}){const r=e.filter(Boolean),s={state:{page:t,branch:e,session_id:this.session_id},props:{components:r.map((t=>t.module.default))}};for(let o=0;o<r.length;o+=1)r[o].loaded&&(s.props[`props_${o}`]=await r[o].loaded.props);this.current.page&&t.path===this.current.page.path&&t.query.toString()===this.current.page.query.toString()||(s.props.page=t);const a=r[r.length-1],n=a.loaded&&a.loaded.maxage;if(n){const e=`${t.path}?${t.query}`;let r=!1;const a=()=>{this.cache.get(e)===s&&this.cache.delete(e),i(),clearTimeout(o)},o=setTimeout(a,1e3*n),i=this.stores.session.subscribe((()=>{r&&a()}));r=!0,this.cache.set(e,s)}return s}async _load_node({status:t,error:e,module:r,page:s,context:a}){const n={module:r,uses:{params:new Set,path:!1,query:!1,session:!1,context:!1,dependencies:[]},loaded:null,context:a},o={};for(const i in s.params)Object.defineProperty(o,i,{get:()=>(n.uses.params.add(i),s.params[i]),enumerable:!0});const l=this.$session;if(r.load){const{started:c}=this,u={page:{host:s.host,params:o,get path(){return n.uses.path=!0,s.path},get query(){return n.uses.query=!0,s.query}},get session(){return n.uses.session=!0,l},get context(){return n.uses.context=!0,i({},a)},fetch(t,e){const r="string"==typeof t?t:t.url,{href:a}=new URL(r,new URL(s.path,document.baseURI));return n.uses.dependencies.push(a),c?fetch(t,e):st(t,e)}};e&&(u.status=t,u.error=e);const h=await r.load.call(null,u);if(!h)return;n.loaded=function(t){if(t.error){const e="string"==typeof t.error?new Error(t.error):t.error,r=t.status;return e instanceof Error?!r||r<400||r>599?(console.warn('"error" returned from load() without a valid status code — defaulting to 500'),{status:500,error:e}):{status:r,error:e}:{status:500,error:new Error(`"error" property returned from load() must be a string or instance of Error, received type "${typeof e}"`)}}if(t.redirect){if(!t.status||3!==Math.floor(t.status/100))return{status:500,error:new Error('"redirect" property returned from load() must be accompanied by a 3xx status code')};if("string"!=typeof t.redirect)return{status:500,error:new Error('"redirect" property returned from load() must be a string')}}return t}(h),n.loaded.context&&(n.context=n.loaded.context)}return n}async _load({route:t,path:e,query:r},s){const a=`${e}?${r}`;if(!s&&this.cache.has(a))return this.cache.get(a);const[n,o,l,c]=t,u=c?c(n.exec(e)):{},h=this.current.page&&{path:e!==this.current.page.path,params:Object.keys(u).filter((t=>this.current.page.params[t]!==u[t])),query:r.toString()!==this.current.page.query.toString(),session:this.session_id!==this.current.session_id},d={host:this.host,path:e,query:r,params:u},p=[];let f={},g=!1,m=200,_=null;o.forEach((t=>t()));t:for(let v=0;v<o.length;v+=1){let t;try{if(!o[v])continue;const e=await o[v](),r=this.current.branch[v];if(!r||e!==r.module||h.path&&r.uses.path||h.params.some((t=>r.uses.params.has(t)))||h.query&&r.uses.query||h.session&&r.uses.session||r.uses.dependencies.some((t=>this.invalid.has(t)))||g&&r.uses.context){t=await this._load_node({module:e,page:d,context:f});const r=v===o.length-1;if(t&&t.loaded){if(t.loaded.error&&(m=t.loaded.status,_=t.loaded.error),t.loaded.redirect)return{redirect:t.loaded.redirect};t.loaded.context&&(g=!0)}else if(r&&e.load)return}else t=r}catch(y){m=500,_=y}if(_){for(;v--;)if(l[v]){let t,e,r=v;for(;!(e=p[r]);)r-=1;try{if(t=await this._load_node({status:m,error:_,module:await l[v](),page:d,context:e.context}),t.loaded.error)continue;p.push(t);break t}catch(y){continue}}return await this._load_error({status:m,error:_,path:e,query:r})}t&&t.loaded&&t.loaded.context&&(f=i(i({},f),t.loaded.context)),p.push(t)}return await this._get_navigation_result_from_branch({page:d,branch:p})}async _load_error({status:t,error:e,path:r,query:s}){const a={host:this.host,path:r,query:s,params:{}},n=await this._load_node({module:await this.fallback[0],page:a,context:{}}),o=[n,await this._load_node({status:t,error:e,module:await this.fallback[1],page:a,context:n&&n.loaded&&n.loaded.context})];return await this._get_navigation_result_from_branch({page:a,branch:o})}}async function nt({paths:t,target:e,session:r,host:s,route:a,spa:n,trailing_slash:o,hydrate:i}){const l=a&&new et({base:t.base,routes:H,trailing_slash:o}),c=new at({Root:Y,fallback:Q,target:e,session:r,host:s});i&&await c.start(i),a&&l.init(c),n&&l.goto(location.href,{replaceState:!0},[]),dispatchEvent(new CustomEvent("sveltekit:start"))}export{nt as start};
|
import React from 'react'
import TZIGrid from './TZIGrid'
import { StaticQuery, graphql, navigate } from 'gatsby'
import { css } from '@emotion/core'
import Img from "gatsby-image"
import theme from '../../config/theme'
const animalLinkCss = css`
border: 3px solid #eaeaea;
border-radius: 3px;
&:hover {
background-color: #eaeaea;
border: 3px solid ${theme.colors.link_color_hover}
}
`
export default () => (
<StaticQuery
query={graphql`
query {
allFile(filter: {
relativeDirectory: {eq: "animals"}
extension: {eq: "png"}
}) {
edges {
node {
id
name
childImageSharp {
fluid(maxWidth: 300) {
...GatsbyImageSharpFluid_withWebp_tracedSVG
}
}
}
}
}
}
`}
render={data => {
let imgTags = data.allFile.edges.map(({ node }) => {
let refStr = node.name.substring(0, node.name.length - 5)
return (
<div name={refStr} onClick={() => navigate(refStr)}>
<Img css={animalLinkCss} key={node.id} fluid={node.childImageSharp.fluid} />
</div>
)})
const animals = ["rat", "ox", "tiger", "rabbit", "dragon", "snake", "horse", "sheep", "monkey", "rooster", "dog", "pig" ]
// Sort image tags in proper order before sending to TZIGrid
imgTags = imgTags.sort(function(a,b) {
return animals.indexOf( a.props.name ) - animals.indexOf( b.props.name )})
return (
<div>
<TZIGrid data={imgTags}/>
</div>
)
}}
/>
)
|
import Reality from '../Reality.js'
import XRAnchor from '../XRAnchor.js'
import XRViewPose from '../XRViewPose.js'
import XRAnchorOffset from '../XRAnchorOffset.js'
import XRLightEstimate from '../XRLightEstimate.js'
import MatrixMath from '../fill/MatrixMath.js'
import Quaternion from '../fill/Quaternion.js'
import ARKitWrapper from '../platform/ARKitWrapper.js'
import ARCoreCameraRenderer from '../platform/ARCoreCameraRenderer.js'
import XRImageAnchor from "../XRImageAnchor.js"
import XRPlaneAnchor from "../XRPlaneAnchor.js"
import XRFaceAnchor from "../XRFaceAnchor.js"
/*
CameraReality displays the forward facing camera.
If this is running in the iOS ARKit wrapper app, the camera data will be displayed in a Metal layer below the WKWebKit layer.
If this is running in the Google ARCore Chrome application, it will create a canvas element and use the ARCore provided camera data.
If there is no ARKit or ARCore available, it will use WebRTC's MediaStream to render camera data into a canvas.
*/
export default class CameraReality extends Reality {
constructor(xr){
super(xr, 'Camera', true, true)
this._initialized = false
this._running = false
// camera fovy: start with 70 degrees on the long axis of at 320x240
this._cameraFov = 70 * Math.PI/180
this._focalLength = 160 / Math.tan(this._cameraFov / 2)
this._cameraIntrinsics = [this._focalLength, 0 , 0,
0, this._focalLength, 0,
160, 120, 1 ]
// These are used if we have access to ARKit
this._arKitWrapper = null
// These are used if we do not have access to ARKit
this._mediaStream = null
this._videoEl = null
// These are used if we're using the Google ARCore web app
this._arCoreCameraRenderer = null
this._arCoreCanvas = null
this._elContext = null
this._vrDisplay = null
this._vrFrameData = null
// dealing with video frames from webrtc
this._sendingVideo = false;
this._videoFramesPaused = false;
this._sendVideoFrame = false;
this._videoProjectionMatrix = MatrixMath.mat4_generateIdentity();
this._videoViewMatrix = MatrixMath.mat4_generateIdentity();
this._lightEstimate = new XRLightEstimate();
// Try to find a WebVR 1.1 display that supports Google's ARCore extensions
if(typeof navigator.getVRDisplays === 'function'){
navigator.getVRDisplays().then(displays => {
for(let display of displays){
if(display === null) continue
if(display.capabilities.hasPassThroughCamera){ // This is the ARCore extension to WebVR 1.1
this._vrDisplay = display
this._vrFrameData = new VRFrameData()
if (!window.WebARonARKitSetData) {
this._arCoreCanvas = document.createElement('canvas')
this._xr._realityEls.appendChild(this._arCoreCanvas)
this._arCoreCanvas.width = window.innerWidth
this._arCoreCanvas.height = window.innerHeight
this._elContext = this._arCoreCanvas.getContext('webgl')
if(this._elContext === null){
throw 'Could not create CameraReality GL context'
}
}
break
}
}
})
}
window.addEventListener('resize', () => {
if(this._arCoreCanvas){
this._arCoreCanvas.width = window.innerWidth
this._arCoreCanvas.height = window.innerHeight
}
if (this._videoEl) {
setTimeout(() => {
this._adjustVideoSize();
}, 10)
}
}, false)
}
_setFovy (fovy) {
this._cameraFov = fovy * Math.PI/180
if (!this._videoEl) {
this._focalLength = 0
return
}
if (this._videoRenderWidth > this._videoRenderHeight) {
this._focalLength = (this._videoRenderWidth/2) / Math.tan(this._cameraFov / 2)
} else {
this._focalLength = (this._videoRenderHeight/2) / Math.tan(this._cameraFov / 2)
}
this._cameraIntrinsics = [this._focalLength, 0 , 0,
0, this._focalLength, 0,
(this._videoRenderWidth/2), (this._videoRenderHeight/2), 1 ]
}
_adjustVideoSize () {
var canvasWidth = this._videoRenderWidth;
var canvasHeight = this._videoRenderHeight;
var cameraAspect = canvasWidth / canvasHeight;
var width = this._videoEl.videoWidth;
var height = this._videoEl.videoHeight;
var videoSourceAspect = width / height;
if (videoSourceAspect != cameraAspect) {
// let's pick a size such that the video is below 512 in size in both dimensions
while (width > 512 || height > 512) {
width = width / 2
height = height / 2
}
canvasWidth = this._videoRenderWidth = width;
canvasHeight = this._videoRenderHeight = height;
var cameraAspect = canvasWidth / canvasHeight;
this._videoFrameCanvas.width = width;
this._videoFrameCanvas.height = height;
}
this._setFovy(this._cameraFov / (Math.PI/180))
var windowWidth = this._xr._realityEls.clientWidth;
var windowHeight = this._xr._realityEls.clientHeight;
var windowAspect = windowWidth / windowHeight;
var translateX = 0;
var translateY = 0;
if (cameraAspect > windowAspect) {
canvasWidth = canvasHeight * windowAspect;
windowWidth = windowHeight * cameraAspect;
translateX = -(windowWidth - this._xr._realityEls.clientWidth)/2;
} else {
canvasHeight = canvasWidth / windowAspect;
windowHeight = windowWidth / cameraAspect;
translateY = -(windowHeight - this._xr._realityEls.clientHeight)/2;
}
this._videoEl.style.width = windowWidth.toFixed(2) + 'px'
this._videoEl.style.height = windowHeight.toFixed(2) + 'px'
this._videoEl.style.transform = "translate(" + translateX.toFixed(2) + "px, "+ translateY.toFixed(2) + "px)"
try {
this.dispatchEvent(
new CustomEvent(
Reality.WINDOW_RESIZE_EVENT,
{
source: this,
detail: {
width: canvasWidth,
height: canvasHeight,
focalLength: this._focalLength
}
}
)
)
} catch(e) {
console.error('WINDOW_RESIZE_EVENT error', e)
}
}
/*
Called by a session before it hands a new XRPresentationFrame to the app
*/
_handleNewFrame(frame){
if(this._vrDisplay){
if (this._arCoreCameraRenderer) {
this._arCoreCameraRenderer.render()
}
this._vrDisplay.getFrameData(this._vrFrameData)
}
// WebRTC video
if (this._videoEl && this._sendVideoFrame && !this._videoFramesPaused) {
this._sendVideoFrame = false;
var canvasWidth = this._videoRenderWidth;
var canvasHeight = this._videoRenderHeight;
this._videoCtx.drawImage(this._videoEl, 0, 0, canvasWidth, canvasHeight);
var imageData = this._videoCtx.getImageData(0, 0, canvasWidth, canvasHeight);
var data = imageData.data
var len = imageData.data.length
// imageData = new ArrayBuffer(len)
// var buffData = new Uint8Array(imageData);
// for (var i = 0; i < len; i++) buffData[i] = data[i]
var buffers = [
{
size: {
width: canvasWidth,
height: canvasHeight,
bytesPerRow: canvasWidth * 4,
bytesPerPixel: 4
},
buffer: imageData
}];
var pixelFormat = XRVideoFrame.IMAGEFORMAT_RGBA32;
var timestamp = frame.timestamp;
// set from frame
var view = frame.views[0];
//this._videoViewMatrix.set(view.viewMatrix);
MatrixMath.mat4_invert(this._videoViewMatrix, view.viewMatrix)
this._videoProjectionMatrix.set(view.projectionMatrix)
var camera = {
arCamera: false,
cameraOrientation: 0,
cameraIntrinsics: this._cameraIntrinsics.slice(0),
// cameraIntrinsics: [(this._videoEl.videoWidth/2) / Math.tan(view._fov.leftDegrees * Math.PI/180), 0, (this._videoEl.videoWidth/2),
// 0, (this._videoEl.videoHeight/2) / Math.tan(view._fov.upDegrees * Math.PI/180), (this._videoEl.videoHeight/2),
// 0, 0, 1],
cameraImageResolution: {
width: this._videoEl.videoWidth,
height: this._videoEl.videoHeight
},
viewMatrix: this._videoViewMatrix,
projectionMatrix: this._videoProjectionMatrix
}
var xrVideoFrame = new XRVideoFrame(buffers, pixelFormat, timestamp, camera )
try {
this.dispatchEvent(
new CustomEvent(
Reality.COMPUTER_VISION_DATA,
{
source: this,
detail: xrVideoFrame
}
)
)
} catch(e) {
console.error('COMPUTER_VISION_DATA event error', e)
}
}
// TODO update the anchor positions using ARCore or ARKit
}
_start(parameters=null){
if(this._running) return
this._running = true
if(this._vrDisplay !== null){ // Using WebAR
if (window.WebARonARKitSetData) {
// WebARonARKit renders camera separately
} else {
this._arCoreCameraRenderer = new ARCoreCameraRenderer(this._vrDisplay, this._elContext)
}
this._initialized = true
} else if(ARKitWrapper.HasARKit()){ // Using ARKit
if(this._initialized === false){
this._initialized = true
this._arKitWrapper = ARKitWrapper.GetOrCreate()
this._arKitWrapper.addEventListener(ARKitWrapper.WATCH_EVENT, this._handleARKitWatch.bind(this))
this._arKitWrapper.waitForInit().then(() => {
this._arKitWrapper.watch(parameters)
})
} else {
this._arKitWrapper.watch(parameters)
}
} else { // Using WebRTC
if(this._initialized === false){
this._initialized = true
navigator.mediaDevices.getUserMedia({
audio: false,
video: { facingMode: "environment" }
}).then(stream => {
this._videoEl = document.createElement('video')
this._xr._realityEls.appendChild(this._videoEl)
this._videoEl.setAttribute('class', 'camera-reality-video')
this._videoEl.setAttribute('playsinline', true);
this._videoEl.style.width = '100%'
this._videoEl.style.height = '100%'
this._videoEl.srcObject = stream
this._videoEl.play()
this._setupWebRTC(parameters)
}).catch(err => {
console.error('Could not set up video stream', err)
this._initialized = false
this._running = false
})
} else {
if (this._videoEl) {
this._xr._realityEls.appendChild(this._videoEl)
this._videoEl.play()
this._setupWebRTC(parameters)
}
}
}
}
_setupWebRTC(parameters) {
if (parameters.videoFrames) {
this._sendingVideo = true;
this._videoEl.addEventListener('loadedmetadata', () => {
var width = this._videoEl.videoWidth;
var height = this._videoEl.videoHeight;
// let's pick a size such that the video is below 512 in size in both dimensions
while (width > 256 || height > 256) {
width = width / 2
height = height / 2
}
this._videoRenderWidth = width;
this._videoRenderHeight = height;
this._videoFrameCanvas = document.createElement('canvas');
this._videoFrameCanvas.width = width;
this._videoFrameCanvas.height = height;
this._videoCtx = this._videoFrameCanvas.getContext('2d');
this._adjustVideoSize();
this._sendVideoFrame = true;
});
}
}
_requestVideoFrame() {
this._sendVideoFrame = true;
}
_stopVideoFrames() {
this._videoFramesPaused = true;
}
_startVideoFrames() {
this._videoFramesPaused = false;
}
_stop(){
if(this._running === false) return
this._running = false
if(ARKitWrapper.HasARKit()){
if(this._arKitWrapper === null){
return
}
this._arKitWrapper.stop()
} else if(this._arCoreCanvas){
this._xr._realityEls.removeChild(this._arCoreCanvas)
this._arCoreCanvas = null
} else if(this._videoEl !== null){
this._videoEl.pause()
this._xr._realityEls.removeChild(this._videoEl)
}
}
_handleARKitWatch(ev){
if(ev.detail && ev.detail.objects){
for(let anchorInfo of ev.detail.objects){
this._updateAnchorFromARKitUpdate(anchorInfo.uuid, anchorInfo)
try {
this.dispatchEvent(
new CustomEvent(
Reality.UPDATE_WORLD_ANCHOR,
{
source: this,
detail: anchorInfo.uuid
}
)
)
} catch(e) {
console.error('UPDATE_WORLD_ANCHOR event error', e)
}
}
}
if (ev.detail && ev.detail.removedObjects) {
for (let removedAnchor of ev.detail.removedObjects) {
try {
this.dispatchEvent(
new CustomEvent(
Reality.REMOVE_WORLD_ANCHOR,
{
source: this,
detail: removedAnchor
}
)
)
} catch(e) {
console.error('REMOVE_WORLD_ANCHOR event error', e)
}
this._deleteAnchorFromARKitUpdate(removedAnchor)
}
}
if (ev.detail && ev.detail.newObjects) {
for (let addedAnchor of ev.detail.newObjects) {
try {
this.dispatchEvent(
new CustomEvent(
Reality.NEW_WORLD_ANCHOR,
{
source: this,
detail: addedAnchor
}
)
)
} catch(e) {
console.error('NEW_WORLD_ANCHOR event error', e)
}
}
}
}
_deleteAnchorFromARKitUpdate(anchorUUID) {
this._anchors.delete(anchorUUID)
}
_handleARKitAddObject(anchorInfo){
this._updateAnchorFromARKitUpdate(anchorInfo.uuid, anchorInfo)
}
_updateAnchorFromARKitUpdate(uid, anchorInfo){
const anchor = this._anchors.get(uid) || null
if(anchor === null){
// console.log('unknown anchor', anchor)
return
}
// This assumes that the anchor's coordinates are in the tracker coordinate system
anchor.coordinateSystem._relativeMatrix = anchorInfo.transform
// update internal data if any
switch (anchorInfo.type) {
case ARKitWrapper.ANCHOR_TYPE_PLANE:
anchor.center = anchorInfo.plane_center
anchor.extent =
[anchorInfo.plane_extent.x, anchorInfo.plane_extent.z]
anchor.alignment = anchorInfo.plane_alignment
anchor.geometry = anchorInfo.geometry
break
case ARKitWrapper.ANCHOR_TYPE_FACE:
if (anchorInfo.geometry) {
anchor.geometry.vertices = anchorInfo.geometry.vertices
}
if (anchorInfo.blendShapes) {
anchor.updateBlendShapes(anchorInfo.blendShapes)
}
break
case ARKitWrapper.ANCHOR_TYPE_ANCHOR:
break
case ARKitWrapper.ANCHOR_TYPE_IMAGE:
break
}
}
_addAnchor(anchor, display){
// Convert coordinates to the tracker coordinate system so that updating from ARKit transforms is simple
if(this._arKitWrapper !== null){
this._arKitWrapper.addAnchor(anchor.uid, anchor.coordinateSystem._poseModelMatrix).then(
detail => this._handleARKitAddObject(detail)
)
}
// ARCore as implemented in the browser does not offer anchors except on a surface, so we just use untracked anchors
// We also use untracked anchors for in-browser display, with WebRTC
this._anchors.set(anchor.uid, anchor)
return anchor.uid
}
/*
Creates an anchor offset relative to a surface, as found by a ray
normalized screen x and y are in range 0..1, with 0,0 at top left and 1,1 at bottom right
returns a Promise that resolves either to an AnchorOffset with the first hit result or null if the hit test failed
*/
_findAnchor(normalizedScreenX, normalizedScreenY, display, testOptions=null){
return new Promise((resolve, reject) => {
if(this._arKitWrapper !== null){
// Perform a hit test using the ARKit integration
this._arKitWrapper.hitTest(normalizedScreenX, normalizedScreenY, testOptions || ARKitWrapper.HIT_TEST_TYPE_EXISTING_PLANES).then(hits => {
if(hits.length === 0){
resolve(null)
// console.log('miss')
return
}
const hit = this._pickARKitHit(hits)
// if it's a plane
if (hit.anchor_transform) {
hit.anchor_transform[13] += XRViewPose.SITTING_EYE_HEIGHT
hit.world_transform[13] += XRViewPose.SITTING_EYE_HEIGHT
// Use the first hit to create an XRAnchorOffset, creating the XRAnchor as necessary
// TODO use XRPlaneAnchor for anchors with extents; hopefully the plane will have been created, tho
let anchor = this._getAnchor(hit.uuid)
if(anchor === null){
let coordinateSystem = new XRCoordinateSystem(display, XRCoordinateSystem.TRACKER)
coordinateSystem._relativeMatrix = hit.anchor_transform
anchor = new XRAnchor(coordinateSystem, hit.uuid)
this._anchors.set(anchor.uid, anchor)
}
const offsetPosition = [
hit.world_transform[12] - hit.anchor_transform[12],
hit.world_transform[13] - hit.anchor_transform[13],
hit.world_transform[14] - hit.anchor_transform[14]
]
const worldRotation = new Quaternion().setFromRotationMatrix(hit.world_transform)
const inverseAnchorRotation = new Quaternion().setFromRotationMatrix(hit.anchor_transform).inverse()
const offsetRotation = new Quaternion().multiplyQuaternions(worldRotation, inverseAnchorRotation)
const anchorOffset = new XRAnchorOffset(anchor.uid)
anchorOffset.poseMatrix = MatrixMath.mat4_fromRotationTranslation(new Float32Array(16), offsetRotation.toArray(), offsetPosition)
resolve(anchorOffset)
} else {
let coordinateSystem = new XRCoordinateSystem(display, XRCoordinateSystem.TRACKER)
coordinateSystem._relativeMatrix = hit.world_transform
const anchor = new XRAnchor(coordinateSystem, hit.uuid)
this._anchors.set(anchor.uid, anchor)
const anchorOffset = new XRAnchorOffset(anchor.uid)
resolve(anchorOffset)
}
})
} else if(this._vrDisplay !== null){
// Perform a hit test using the ARCore data
let hits = this._vrDisplay.hitTest(normalizedScreenX, normalizedScreenY)
if(hits.length == 0){
resolve(null)
return
}
hits.sort((a, b) => a.distance - b.distance)
let anchor = this._getAnchor(hits[0].uuid)
if(anchor === null){
let coordinateSystem = new XRCoordinateSystem(display, XRCoordinateSystem.TRACKER)
coordinateSystem._relativeMatrix = hits[0].modelMatrix
coordinateSystem._relativeMatrix[13] += XRViewPose.SITTING_EYE_HEIGHT
anchor = new XRAnchor(coordinateSystem)
this._anchors.set(anchor.uid, anchor)
}
resolve(new XRAnchorOffset(anchor.uid))
} else {
resolve(null) // No platform support for finding anchors
}
})
}
/**
* Creates an ARReferenceImage in the ARKit native side
* @param uid the ID of the image to create
* @param buffer the base64 encoded image
* @param width
* @param height
* @param physicalWidthInMeters
* @returns a promise when the image has been created, error otherwise
* @private
*/
_createImageAnchor(uid, buffer, width, height, physicalWidthInMeters) {
if (this._arKitWrapper) {
return this._arKitWrapper.createImageAnchor(uid, buffer, width, height, physicalWidthInMeters)
} else {
return null;
}
}
/**
* _activateDetectionImage Uses the ARKit wrapper to add a new reference image to the set of detection images in the ARKit configuration object
* and runs the session again. The promise is resolved when the image is detected by ARKit
* @param uid The name (id) if the image to activate. It has to be previously created calling the "createImageAnchor" method
* @param display The current display
* @returns {Promise<any>} A promise resolved with the image transform in case of success, rejected with error otherwise
*/
_activateDetectionImage(uid, display) {
return new Promise((resolve, reject) => {
if (this._arKitWrapper) {
this._arKitWrapper.activateDetectionImage(uid).then(aRKitImageAnchor => {
if (aRKitImageAnchor.activated === true) {
let coordinateSystem = new XRCoordinateSystem(display, XRCoordinateSystem.TRACKER)
coordinateSystem._relativeMatrix = aRKitImageAnchor.imageAnchor.transform
let anchor = new XRImageAnchor(coordinateSystem, aRKitImageAnchor.imageAnchor.uuid)
this._anchors.set(aRKitImageAnchor.imageAnchor.uuid, anchor)
resolve(aRKitImageAnchor.imageAnchor.transform)
} else if (aRKitImageAnchor.error !== null) {
reject(aRKitImageAnchor.error)
} else {
reject(null)
}
})
} else {
reject('ARKit not supported')
}
})
}
_removeAnchor(uid){
if(this._arKitWrapper) {
this._arKitWrapper.removeAnchor(uid)
} else if (this._getAnchor(uid)) {
this._anchors.delete(uid)
}
}
_pickARKitHit(data){
if(data.length === 0) return null
let info = null
let planeResults = data.filter(
hitTestResult => hitTestResult.type != ARKitWrapper.HIT_TEST_TYPE_FEATURE_POINT
)
let planeExistingUsingExtentResults = planeResults.filter(
hitTestResult => hitTestResult.type == ARKitWrapper.HIT_TEST_TYPE_EXISTING_PLANE_USING_EXTENT
)
let planeExistingResults = planeResults.filter(
hitTestResult => hitTestResult.type == ARKitWrapper.HIT_TEST_TYPE_EXISTING_PLANE
)
if (planeExistingUsingExtentResults.length) {
// existing planes using extent first
planeExistingUsingExtentResults = planeExistingUsingExtentResults.sort((a, b) => a.distance - b.distance)
info = planeExistingUsingExtentResults[0]
} else if (planeExistingResults.length) {
// then other existing planes
planeExistingResults = planeExistingResults.sort((a, b) => a.distance - b.distance)
info = planeExistingResults[0]
} else if (planeResults.length) {
// other types except feature points
planeResults = planeResults.sort((a, b) => a.distance - b.distance)
info = planeResults[0]
} else {
// feature points if any
info = data[0]
}
return info
}
/*
Found intersections with anchors and planes by a ray normalized screen x and y are in range 0..1, with 0,0 at top left and 1,1 at bottom right
returns an Array of VRHit
*/
_hitTestNoAnchor(normalizedScreenX, normalizedScreenY, display){
if(this._arKitWrapper !== null){
// Perform a hit test using the ARKit integration
let hits = this._arKitWrapper.hitTestNoAnchor(normalizedScreenX, normalizedScreenY);
for (let i = 0; i < hits.length; i++) {
hits[i].modelMatrix[13] += XRViewPose.SITTING_EYE_HEIGHT
}
if(hits.length == 0){
return null;
}
return hits;
} else if(this._vrDisplay !== null) {
// Perform a hit test using the ARCore data
let hits = this._vrDisplay.hitTest(normalizedScreenX, normalizedScreenY)
for (let i = 0; i < hits.length; i++) {
hits[i].modelMatrix[13] += XRViewPose.SITTING_EYE_HEIGHT
}
if(hits.length == 0){
return null;
}
return hits;
} else {
// No platform support for finding anchors
return null;
}
}
_getHasLightEstimate(){
if(this._arKitWrapper !== null){
return true;
}else{
return false;
}
}
_getLightAmbientIntensity(){
if(this._arKitWrapper !== null){
this._lightEstimate.ambientIntensity = this._arKitWrapper.lightIntensity;
return this._lightEstimate.ambientIntensity;
}else{
// No platform support for ligth estimation
return null;
}
}
_getWorldMappingStatus(){
if(this._arKitWrapper !== null){
return this._arKitWrapper.worldMappingStatus;
}else{
// No platform support for ligth estimation
return null;
}
}
/**
* retrieves a worldMap from the platform, if possible
* @returns a promise when the worldMap has been retrieved
* @private
*/
_getWorldMap() {
return new Promise((resolve, reject) => {
if (this._arKitWrapper) {
this._arKitWrapper.getWorldMap().then(ARKitWorldMap => {
if (ARKitWorldMap.saved === true) {
resolve(ARKitWorldMap.worldMap)
} else if (ARKitWorldMap.error !== null) {
reject(ARKitWorldMap.error)
} else {
reject(null)
}
})
} else {
reject('ARKit not supported')
}
})
}
/**
* sets a worldMap for the platform, if possible
* @param worldMap a platform specific worldmap
* @returns a promise when the worldMap has been set
* @private
*/
_setWorldMap(worldMap) {
if (this._arKitWrapper) {
return this._arKitWrapper.setWorldMap(worldMap)
} else {
return new Promise((resolve, reject) => {
reject(new Error('setWorldMap not supported'));
})
}
}
_getTimeStamp(timestamp) {
if(this._arKitWrapper !== null){
return this._arKitWrapper.timestamp;
}else{
// use performance.now()
//return ( performance || Date ).now();
return timestamp
}
}
/*
No floor in AR
*/
_findFloorAnchor(display, uid=null){
return new Promise((resolve, reject) => {
resolve(null)
})
}
}
|
/**
* Licensed to The Apereo Foundation under one or more contributor license
* agreements. See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
*
* The Apereo Foundation licenses this file to you under the Educational
* Community 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://opensource.org/licenses/ecl2.txt
*
* 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.
*
*/
'use strict';
angular.module('adminNg.services')
.factory('NewEventSource', ['JsHelper', 'CaptureAgentsResource', 'ConflictCheckResource', 'Notifications', 'Language',
'$translate', '$filter', 'underscore', '$timeout', 'localStorageService', 'AuthService', 'SchedulingHelperService',
function (JsHelper, CaptureAgentsResource, ConflictCheckResource, Notifications, Language, $translate, $filter, _,
$timeout, localStorageService, AuthService, SchedulingHelperService) {
// -- constants ------------------------------------------------------------------------------------------------- --
var NOTIFICATION_CONTEXT = 'events-form';
var SCHEDULE_SINGLE = 'SCHEDULE_SINGLE';
var SCHEDULE_MULTIPLE = 'SCHEDULE_MULTIPLE';
var WEEKDAY_PREFIX = 'EVENTS.EVENTS.NEW.WEEKDAYSLONG.';
var UPLOAD = 'UPLOAD';
var WEEKDAYS = {
'MO': WEEKDAY_PREFIX + 'MO',
'TU': WEEKDAY_PREFIX + 'TU',
'WE': WEEKDAY_PREFIX + 'WE',
'TH': WEEKDAY_PREFIX + 'TH',
'FR': WEEKDAY_PREFIX + 'FR',
'SA': WEEKDAY_PREFIX + 'SA',
'SU': WEEKDAY_PREFIX + 'SU'
};
// -- instance -------------------------------------------------------------------------------------------------- --
var Source = function () {
var self = this;
this.save = function () {
self.ud.UPLOAD.metadata['start'] = self.startDate;
};
this.createStartDate = function () {
self.startDate = {
'id': 'startDate',
'label': 'EVENTS.EVENTS.DETAILS.METADATA.START_DATE',
'value': new Date(Date.now()).toISOString(),
'type': 'date',
'readOnly': false,
'required': false,
'tabindex': 7
};
};
self.isSourceState = true;
this.defaultsSet = false;
this.checkingConflicts = false;
this.hasConflicts = false;
this.conflicts = [];
this.hasConflictingSettings = function () {
return self.hasConflicts;
};
/* Get the current client timezone */
self.tzOffset = (new Date()).getTimezoneOffset() / -60;
self.tz = 'UTC' + (self.tzOffset < 0 ? '' : '+') + self.tzOffset;
this.loadCaptureAgents = function () {
CaptureAgentsResource.query({inputs: true}).$promise.then(function (data) {
self.captureAgents = data.rows;
}).catch(angular.noop);
};
this.loadCaptureAgents();
this.clearConflicts = function () {
self.conflicts.splice(0);
self.hasConflicts = false;
};
this.removeAllNotifications = function () {
self.notification = undefined;
self.alreadyEndedNotification = undefined;
self.endBeforeStartNotification = undefined;
Notifications.removeAll(NOTIFICATION_CONTEXT);
};
this.reset = function (opts) {
self.removeAllNotifications();
self.clearConflicts();
self.createStartDate();
self.weekdays = _.clone(WEEKDAYS);
self.ud = {
UPLOAD: {
tracks: {},
metadata: {
start: self.startDate
}
},
SCHEDULE_SINGLE: {
device: {
inputMethods: {}
}
},
SCHEDULE_MULTIPLE: {
device: {
inputMethods: {}
},
weekdays: {},
presentableWeekdays: ''
},
type: 'UPLOAD'
};
if (opts) {
if (opts.resetDefaults) {
self.defaultsSet = !opts.resetDefaults;
return;
}
var singleKeys = ['duration', 'start', 'end', 'device']; //Only apply these default fields to SCHEDULE_SINGLE
for (var key in opts) {
if (key === 'type') {
continue;
}
self.ud.SCHEDULE_MULTIPLE[key] = angular.copy(opts[key]);
if (singleKeys.indexOf(key) > -1) {
self.ud.SCHEDULE_SINGLE[key] = angular.copy(opts[key]);
}
}
if (opts.presentableWeekdays) {
self.ud.SCHEDULE_MULTIPLE.weekdays[opts.presentableWeekdays.toUpperCase()] = true;
}
if (opts.type) {
self.ud.type = opts.type;
}
self.checkConflicts();
}
};
this.reset();
this.changeType = function() {
localStorageService.set('sourceSticky', getType());
};
this.sortedWeekdays = _.map(self.weekdays, function(day, index) {
return { key: index, translation: day.replace('LONG', '') };
});
this.hours = JsHelper.initArray(24);
this.minutes = JsHelper.initArray(60);
this.roomChanged = function () {
self.ud[self.ud.type].device.inputMethods = {};
self.ud[self.ud.type]
.device.inputs.forEach(function(input) {
self.ud[self.ud.type].device.inputMethods[input.id] = true;
});
};
this.toggleWeekday = function (weekday) {
var weekdays = self.ud[SCHEDULE_MULTIPLE].weekdays;
if (_.has(weekdays, weekday)) {
weekdays[weekday] = !weekdays[weekday];
}
};
/*
* Some internal utilities.
*/
var fields = [
'start.date',
'start.hour',
'start.minute',
'duration.hour',
'duration.minute',
'end.date',
'end.hour',
'end.minute',
'device.name'];
var getType = function() { return self.ud.type; };
var isDefined = function(value) { return !(_.isUndefined(value) || _.isNull(value)); };
var validators = {
later: function() { return true; },
UPLOAD: function() {
// test for any type of upload source (MH-12085)
return Object.keys(self.ud.UPLOAD.tracks).length > 0;
},
SCHEDULE_SINGLE: function () {
return !self.hasConflicts && _.every(fields, function(field) {
var fieldValue = JsHelper.getNested(self.ud[SCHEDULE_SINGLE], field);
return isDefined(fieldValue);
});
},
SCHEDULE_MULTIPLE: function() {
var isAllFieldsDefined = _.every(fields, function(field) {
var fieldValue = JsHelper.getNested(self.ud[SCHEDULE_MULTIPLE], field);
return isDefined(fieldValue);
});
return !self.hasConflicts && isAllFieldsDefined && self.atLeastOneRepetitionDayMarked();
}
};
this.isScheduleSingle = function() { return getType() === SCHEDULE_SINGLE; };
this.isScheduleMultiple = function() { return getType() === SCHEDULE_MULTIPLE; };
this.isUpload = function() { return getType() === UPLOAD; };
this.atLeastOneInputMethodDefined = function () {
var inputMethods = self.ud[getType()].device.inputMethods;
return isDefined(_.find(inputMethods, function(inputMethod) { return inputMethod; }));
};
this.atLeastOneRepetitionDayMarked = function () {
return isDefined(_.find(self.ud[SCHEDULE_MULTIPLE].weekdays, function(weekday) { return weekday; }));
};
this.canPollConflicts = function () {
var data = self.ud[getType()];
var result = isDefined(data) && isDefined(data.start) &&
isDefined(data.start.date) && data.start.date.length > 0 &&
angular.isDefined(data.duration) &&
angular.isDefined(data.duration.hour) && angular.isDefined(data.duration.minute) &&
isDefined(data.device) &&
isDefined(data.device.id) && data.device.id.length > 0;
if (self.isScheduleMultiple() && result) {
return angular.isDefined(data.end.date) &&
data.end.date.length > 0 &&
self.atLeastOneRepetitionDayMarked();
} else {
return result;
}
};
// Sort source select options by short title
this.translatedSourceShortTitle = function(asset) {
return $filter('translateOverrideFallback')(asset, 'SHORT');
};
// Create the data array for use in the summary view
this.updateUploadTracksForSummary = function () {
self.ud.trackuploadlistforsummary = [];
var namemap = self.wizard.sharedData.uploadNameMap;
angular.forEach(self.ud.UPLOAD.tracks, function ( value, key) {
var item = {};
var fileNames = [];
item.id = key;
item.title = namemap[key].title;
angular.forEach(value, function (file) {
fileNames.push(file.name);
});
item.filename = fileNames.join(', ');
item.type = namemap[key].type;
item.flavor = namemap[key].flavorType + '/' + namemap[key].flavorSubType;
self.ud.trackuploadlistforsummary.push(item);
});
};
this.checkConflicts = function () {
// -- semaphore ----------------------------------------------------------------------------------------- --
var acquire = function() { return !self.checkingConflicts && self.canPollConflicts(); };
var release = function(conflicts) {
self.hasConflicts = _.size(conflicts) > 0;
while (self.conflicts.length > 0) { // remove displayed conflicts, existing ones will be added again in
self.conflicts.pop(); // the next step.
}
if (self.hasConflicts) {
angular.forEach(conflicts, function (d) {
self.conflicts.push({
title: d.title,
start: Language.formatDateTime('medium', d.start),
end: Language.formatDateTime('medium', d.end)
});
});
}
self.updateWeekdays();
self.checkValidity();
};
// -- ajax ---------------------------------------------------------------------------------------------- --
if (acquire()) {
// Notifications.remove(self.notification, NOTIFICATION_CONTEXT);
var onSuccess = function () {
release();
};
var onError = function (response) {
if (response.status === 409) {
if (!self.notification) {
self.notification = Notifications.add('error', 'CONFLICT_DETECTED', NOTIFICATION_CONTEXT, -1);
}
release(response.data);
} else {
// todo show general error
release();
}
};
var settings = self.ud[getType()];
ConflictCheckResource.check(settings, onSuccess, onError);
} else {
self.clearConflicts();
self.removeAllNotifications();
}
};
this.checkValidity = function () {
var data = self.ud[getType()];
if (self.notification && !self.hasConflicts) {
Notifications.remove(self.notification, NOTIFICATION_CONTEXT);
self.notification = undefined;
}
if (self.alreadyEndedNotification) {
Notifications.remove(self.alreadyEndedNotification, NOTIFICATION_CONTEXT);
}
// check if start is in the past and has already ended
if (SchedulingHelperService.alreadyEnded(data.start, data.duration)) {
self.alreadyEndedNotification = Notifications.add('error', 'CONFLICT_ALREADY_ENDED',
NOTIFICATION_CONTEXT, -1);
self.hasConflicts = true;
}
if (self.endBeforeStartNotification) {
Notifications.remove(self.endBeforeStartNotification, NOTIFICATION_CONTEXT);
}
// check if end date is before start date
if (SchedulingHelperService.endBeforeStart(data.start, data.end)) {
self.endBeforeStartNotification = Notifications.add('error', 'CONFLICT_END_BEFORE_START',
NOTIFICATION_CONTEXT, -1);
self.hasConflicts = true;
}
};
/**
* Update the presentation fo the weekdays for the summary
*/
this.updateWeekdays = function () {
var keyWeekdays = [];
var keysOrder = [];
var sortDay = function (day1, day2) {
return keysOrder[day1] - keysOrder[day2];
};
angular.forEach(self.sortedWeekdays, function (day, idx) {
keysOrder[day.translation] = idx;
});
if (self.isScheduleMultiple()) {
angular.forEach(self.ud.SCHEDULE_MULTIPLE.weekdays, function (weekday, index) {
if (weekday) {
keyWeekdays.push(self.weekdays[index]);
}
});
}
keyWeekdays.sort(sortDay);
$translate(keyWeekdays).then(function (translations) {
var translatedWeekdays = [];
angular.forEach(translations, function(t) {
translatedWeekdays.push(t);
});
self.ud[SCHEDULE_MULTIPLE].presentableWeekdays = translatedWeekdays.join(', ');
});
};
this.getFormattedStartTime = function () {
var time;
if (!self.isUpload()) {
var hour = self.ud[getType()].start.hour;
var minute = self.ud[getType()].start.minute;
if (angular.isDefined(hour) && angular.isDefined(minute)) {
time = moment().hour(hour).minute(minute).toISOString();
}
}
return time;
};
this.getFormattedEndTime = function () {
var time;
if (!self.isUpload()) {
var hour = self.ud[getType()].end.hour;
var minute = self.ud[getType()].end.minute;
if (angular.isDefined(hour) && angular.isDefined(minute)) {
time = moment().hour(hour).minute(minute).toISOString();
}
}
return time;
};
this.getFormattedDuration = function () {
var time;
if (!self.isUpload()) {
var hours = self.ud[getType()].duration.hour;
var minutes = self.ud[getType()].duration.minute;
if (hours < 10) { hours = '0' + hours; }
if (minutes < 10) { minutes = '0' + minutes; }
return hours + ':' + minutes;
}
return time;
};
var getValidatorByType = function() {
if (_.has(validators, getType())) {
return validators[getType()];
}
};
// Update summary when exiting this step
// One-time update prevents an infinite loop in
// summary's ng-repeat.
this.ud.trackuploadlistforsummary = [];
this.getTrackUploadSummary = function() {
return this.ud.trackuploadlistforsummary;
};
this.onExitStep = function () {
// update summary of selections
this.updateUploadTracksForSummary();
};
this.isValid = function () {
var validator = getValidatorByType();
if(isDefined(validator)) {
return validator();
}
return false;
};
this.getUserEntries = function () {
return self.ud;
};
this.setDefaultsIfNeeded = function() {
if (self.defaultsSet || !self.hasAgents()) {
return;
}
var defaults = {};
AuthService.getUser().$promise.then(function (user) {
var orgProperties = user.org.properties;
//Variables needed to determine an event's start time
var startTime = orgProperties['admin.event.new.start_time'] || '08:00';
var cutoffTime = orgProperties['admin.event.new.end_time'] || '20:00';
var durationMins = parseInt(orgProperties['admin.event.new.duration'] || 55);
var intervalMins = parseInt(orgProperties['admin.event.new.interval'] || 60);
var chosenSlot = moment( moment().format('YYYY-MM-DD') + ' ' + startTime );
var endSlot = moment( moment().format('YYYY-MM-DD') + ' ' + cutoffTime );
var dateNow = moment();
var timeDiff = dateNow.unix() - chosenSlot.unix();
// Find the next available timeslot for an event's start time
if (timeDiff > 0) {
var multiple = Math.ceil( timeDiff / (intervalMins * 60) );
chosenSlot.add(multiple * intervalMins, 'minute');
if (chosenSlot.unix() >= endSlot.unix()) {
// The slot would start after the defined cutoff time (too late in the day), so we
// use the day's start time on tomorrow
chosenSlot = moment( moment().format('YYYY-MM-DD') + ' ' + startTime ).add(1, 'day');
}
}
var endDateTime = moment( chosenSlot ).add(durationMins, 'minutes');
defaults.start = {
date: chosenSlot.format('YYYY-MM-DD'),
hour: parseInt(chosenSlot.format('H')),
minute: parseInt(chosenSlot.format('mm'))
};
defaults.duration = {
hour: parseInt(durationMins / 60),
minute: durationMins % 60
};
defaults.end = {
date: endDateTime.format('YYYY-MM-DD'),
hour: parseInt(endDateTime.format('H')),
minute: parseInt(endDateTime.format('mm'))
};
if (orgProperties['admin.event.new.preselect_day'] === 'false') {
defaults.presentableWeekdays = '';
} else {
defaults.presentableWeekdays = chosenSlot.format('dd');
}
if (self.captureAgents.length === 0) {
//No capture agents, so user can only upload files
defaults.type = UPLOAD;
}
else if (localStorageService.get('sourceSticky')) {
//auto-select previously chosen source
defaults.type = localStorageService.get('sourceSticky');
}
self.reset(defaults);
self.defaultsSet = true;
}).catch(angular.noop);
};
this.onTemporalValueChange = function(type) {
SchedulingHelperService.applyTemporalValueChange(self.ud[getType()], type, self.isScheduleSingle() );
self.checkConflicts();
};
this.hasAgentAccess = function(agent, index, array) {
return SchedulingHelperService.hasAgentAccess(agent.id);
};
this.hasAgents = function() {
return angular.isDefined(self.captureAgents)
&& self.captureAgents.filter(
function(agent) {
return self.hasAgentAccess(agent, undefined, undefined);
}).length > 0;
};
};
return new Source();
}]);
|
module.exports = {
enterClass: 'fadeIn',
leaveClass: 'fadeOut',
type: 'animation'
};
|
const UserRole = require('./model');
module.exports = {
saveUserRole,
getUserRole
}
// Register new user
function saveUserRole(req, res, next) {
const role = req.body.role ? req.body.role.trim() : '';
const role = req.body.description ? req.body.description.trim() : '';
if (!role) {
return res
.status(422)
.send({ error: 'User Role are required.' });
}
// Check if email already exists
UserRole.findOne({ role: role}, function(err, existingUserRole) {
if (err) return next(err);
// if the email exists return error
if (existingUserRole && existingUserRole.role.length > 0) {
return res
.status(422)
.send({ error: 'The role is already registered.' });
}
// Create a new user object
const newUserRole = new UserRole({
role: role,
description: description
});
// Save the new user into the database
newUserRole.save(function(err, userRoleData) {
if (err) return next(err);
// Respond to request indicating that the user was created
return res.json({
userRole: {
id: userRoleData._id,
role: userRoleData.role,
description: userRoleData.description
}
});
});
});
};
// Get one user
function getUserRole(req, res, next) {
UserRole.findById(req.params.id)
.exec()
.then((userRole) => {
if (!userRole || userRole.email.length <= 0) {
return next(new Error('No user role with that id'));
}
return res.json(userRole)
})
.catch(err => next(err));
};
|
/**
* DevExtreme (ui/pivot_grid/xmla_store/xmla_store.js)
* Version: 19.1.5
* Build date: Tue Jul 30 2019
*
* Copyright (c) 2012 - 2019 Developer Express Inc. ALL RIGHTS RESERVED
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
*/
"use strict";
var _renderer = require("../../../core/renderer");
var _renderer2 = _interopRequireDefault(_renderer);
var _window = require("../../../core/utils/window");
var _class = require("../../../core/class");
var _class2 = _interopRequireDefault(_class);
var _string = require("../../../core/utils/string");
var _errors = require("../../../data/errors");
var _common = require("../../../core/utils/common");
var _extend = require("../../../core/utils/extend");
var _type = require("../../../core/utils/type");
var _iterator = require("../../../core/utils/iterator");
var _array = require("../../../core/utils/array");
var _uiPivot_grid = require("../ui.pivot_grid.utils");
var _deferred = require("../../../core/utils/deferred");
var _language_codes = require("../../../localization/language_codes");
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
"default": obj
}
}
function _toConsumableArray(arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) {
arr2[i] = arr[i]
}
return arr2
} else {
return Array.from(arr)
}
}
var window = (0, _window.getWindow)();
exports.XmlaStore = _class2.default.inherit(function() {
var discover = '<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"><Body><Discover xmlns="urn:schemas-microsoft-com:xml-analysis"><RequestType>{2}</RequestType><Restrictions><RestrictionList><CATALOG_NAME>{0}</CATALOG_NAME><CUBE_NAME>{1}</CUBE_NAME></RestrictionList></Restrictions><Properties><PropertyList><Catalog>{0}</Catalog>{3}</PropertyList></Properties></Discover></Body></Envelope>',
execute = '<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"><Body><Execute xmlns="urn:schemas-microsoft-com:xml-analysis"><Command><Statement>{0}</Statement></Command><Properties><PropertyList><Catalog>{1}</Catalog><ShowHiddenCubes>True</ShowHiddenCubes><SspropInitAppName>Microsoft SQL Server Management Studio</SspropInitAppName><Timeout>3600</Timeout>{2}</PropertyList></Properties></Execute></Body></Envelope>',
mdx = "SELECT {2} FROM {0} {1} CELL PROPERTIES VALUE, FORMAT_STRING, LANGUAGE, BACK_COLOR, FORE_COLOR, FONT_FLAGS",
mdxFilterSelect = "(SELECT {0} FROM {1})",
mdxSubset = "Subset({0}, {1}, {2})",
mdxOrder = "Order({0}, {1}, {2})",
mdxWith = "{0} {1} as {2}",
mdxSlice = "WHERE ({0})",
mdxNonEmpty = "NonEmpty({0}, {1})",
mdxAxis = "{0} DIMENSION PROPERTIES PARENT_UNIQUE_NAME,HIERARCHY_UNIQUE_NAME, MEMBER_VALUE ON {1}",
mdxCrossJoin = "CrossJoin({0})",
mdxSet = "{{0}}",
MEASURE_DEMENSION_KEY = "DX_MEASURES",
MD_DIMTYPE_MEASURE = "2";
function execXMLA(requestOptions, data) {
var deferred = new _deferred.Deferred,
beforeSend = requestOptions.beforeSend,
ajaxSettings = {
url: requestOptions.url,
dataType: "text",
data: data,
headers: {
"Content-Type": "text/xml"
},
xhrFields: {},
method: "POST"
};
if ((0, _type.isFunction)(beforeSend)) {
beforeSend(ajaxSettings)
}(0, _uiPivot_grid.sendRequest)(ajaxSettings).fail(function() {
deferred.reject(arguments)
}).done(function(text) {
var parser = new window.DOMParser;
var xml;
try {
try {
xml = parser.parseFromString(text, "text/xml")
} catch (e) {
xml = void 0
}
if (!xml || xml.getElementsByTagName("parsererror").length || 0 === xml.childNodes.length) {
throw new _errors.errors.Error("E4023", text)
}
} catch (e) {
deferred.reject({
statusText: e.message,
stack: e.stack,
responseText: text
})
}
deferred.resolve(xml)
});
return deferred
}
function getLocaleIdProperty() {
var languageId = (0, _language_codes.getLanguageId)();
if (void 0 !== languageId) {
return (0, _string.format)("<LocaleIdentifier>{0}</LocaleIdentifier>", languageId)
}
return ""
}
function mdxDescendants(level, levelMember, nextLevel) {
var memberExpression = levelMember ? levelMember : level;
return "Descendants({" + memberExpression + "}, " + nextLevel + ", SELF_AND_BEFORE)"
}
function getAllMember(dimension) {
return (dimension.hierarchyName || dimension.dataField) + ".[All]"
}
function getAllMembers(field) {
var result = field.dataField + ".allMembers",
searchValue = field.searchValue;
if (searchValue) {
searchValue = searchValue.replace(/'/g, "''");
result = "Filter(" + result + ", instr(" + field.dataField + ".currentmember.member_caption,'" + searchValue + "') > 0)"
}
return result
}
function crossJoinElements(elements) {
var elementsString = elements.join(",");
return elements.length > 1 ? (0, _string.format)(mdxCrossJoin, elementsString) : elementsString
}
function union(elements) {
var elementsString = elements.join(",");
return elements.length > 1 ? "Union(" + elementsString + ")" : elementsString
}
function generateCrossJoin(path, expandLevel, expandAllCount, expandIndex, slicePath, options, axisName, take) {
var dataField, allMember, hierarchyName, arg, prevDimension, prevHierarchyName, isLastDimensionInGroup, isFirstDimensionInGroup, expandAllIndex, field, member, i, crossJoinArgs = [],
dimensions = options[axisName],
fields = [];
for (i = expandIndex; i <= expandLevel; i++) {
field = dimensions[i];
dataField = field.dataField;
prevHierarchyName = dimensions[i - 1] && dimensions[i - 1].hierarchyName;
hierarchyName = field.hierarchyName;
isLastDimensionInGroup = !hierarchyName || !dimensions[i + 1] || dimensions[i + 1].hierarchyName !== hierarchyName;
expandAllIndex = path.length + expandAllCount + expandIndex;
arg = null;
fields.push(field);
if (i < path.length) {
if (isLastDimensionInGroup) {
arg = "(" + dataField + "." + preparePathValue(path[i], dataField) + ")"
}
} else {
if (i <= expandAllIndex) {
if (0 === i && 0 === expandAllCount) {
allMember = getAllMember(dimensions[expandIndex]);
if (!hierarchyName) {
arg = getAllMembers(dimensions[expandIndex])
} else {
arg = allMember + "," + dimensions[expandIndex].dataField
}
} else {
if (hierarchyName) {
member = preparePathValue(slicePath[slicePath.length - 1]);
if (isLastDimensionInGroup || i === expandAllIndex) {
if (prevHierarchyName === hierarchyName) {
if (slicePath.length) {
prevDimension = dimensions[slicePath.length - 1]
}
if (!prevDimension || prevDimension.hierarchyName !== hierarchyName) {
prevDimension = dimensions[i - 1];
member = ""
}
arg = mdxDescendants(prevDimension.dataField, member, dataField)
} else {
arg = getAllMembers(field)
}
}
} else {
arg = getAllMembers(field)
}
}
} else {
isFirstDimensionInGroup = !hierarchyName || prevHierarchyName !== hierarchyName;
if (isFirstDimensionInGroup) {
arg = "(" + getAllMember(field) + ")"
}
}
}
if (arg) {
arg = (0, _string.format)(mdxSet, arg);
if (take) {
var sortBy = (field.hierarchyName || field.dataField) + ("displayText" === field.sortBy ? ".MEMBER_CAPTION" : ".MEMBER_VALUE");
arg = (0, _string.format)(mdxOrder, arg, sortBy, "desc" === field.sortOrder ? "DESC" : "ASC")
}
crossJoinArgs.push(arg)
}
}
return crossJoinElements(crossJoinArgs)
}
function fillCrossJoins(crossJoins, path, expandLevel, expandIndex, slicePath, options, axisName, cellsString, take, totalsOnly) {
var dimensionIndex, expandAllCount = -1,
dimensions = options[axisName];
do {
expandAllCount++;
dimensionIndex = path.length + expandAllCount + expandIndex;
var crossJoin = generateCrossJoin(path, expandLevel, expandAllCount, expandIndex, slicePath, options, axisName, take);
if (!take && !totalsOnly) {
crossJoin = (0, _string.format)(mdxNonEmpty, crossJoin, cellsString)
}
crossJoins.push(crossJoin)
} while (dimensions[dimensionIndex] && dimensions[dimensionIndex + 1] && dimensions[dimensionIndex].expanded)
}
function declare(expression, withArray, name, type) {
name = name || "[DX_Set_" + withArray.length + "]";
type = type || "set";
withArray.push((0, _string.format)(mdxWith, type, name, expression));
return name
}
function generateAxisMdx(options, axisName, cells, withArray, parseOptions) {
var dimensions = options[axisName],
crossJoins = [],
path = [],
expandedPaths = [],
expandIndex = 0,
expandLevel = 0,
result = [],
cellsString = (0, _string.format)(mdxSet, cells.join(","));
if (dimensions && dimensions.length) {
if (options.headerName === axisName) {
path = options.path;
expandIndex = path.length
} else {
if (options.headerName && options.oppositePath) {
path = options.oppositePath;
expandIndex = path.length
} else {
expandedPaths = ("columns" === axisName ? options.columnExpandedPaths : options.rowExpandedPaths) || expandedPaths
}
}
expandLevel = (0, _uiPivot_grid.getExpandedLevel)(options, axisName);
fillCrossJoins(crossJoins, [], expandLevel, expandIndex, path, options, axisName, cellsString, "rows" === axisName ? options.rowTake : options.columnTake, options.totalsOnly);
(0, _iterator.each)(expandedPaths, function(_, expandedPath) {
fillCrossJoins(crossJoins, expandedPath, expandLevel, expandIndex, expandedPath, options, axisName, cellsString)
});
for (var i = expandLevel; i >= path.length; i--) {
if (dimensions[i].hierarchyName) {
parseOptions.visibleLevels[dimensions[i].hierarchyName] = parseOptions.visibleLevels[dimensions[i].hierarchyName] || [];
parseOptions.visibleLevels[dimensions[i].hierarchyName].push(dimensions[i].dataField)
}
}
}
if (crossJoins.length) {
var expression = union(crossJoins);
if ("rows" === axisName && options.rowTake) {
expression = (0, _string.format)(mdxSubset, expression, options.rowSkip > 0 ? options.rowSkip + 1 : 0, options.rowSkip > 0 ? options.rowTake : options.rowTake + 1)
}
if ("columns" === axisName && options.columnTake) {
expression = (0, _string.format)(mdxSubset, expression, options.columnSkip > 0 ? options.columnSkip + 1 : 0, options.columnSkip > 0 ? options.columnTake : options.columnTake + 1)
}
var axisSet = "[DX_" + axisName + "]";
result.push(declare(expression, withArray, axisSet));
if (options.totalsOnly) {
result.push(declare("COUNT(" + axisSet + ")", withArray, "[DX_" + axisName + "_count]", "member"))
}
}
if ("columns" === axisName && cells.length && !options.skipValues) {
result.push(cellsString)
}
return (0, _string.format)(mdxAxis, crossJoinElements(result), axisName)
}
function generateAxisFieldsFilter(fields) {
var filterMembers = [];
(0, _iterator.each)(fields, function(_, field) {
var filterStringExpression, dataField = field.dataField,
filterExpression = [],
filterValues = field.filterValues || [];
if (field.hierarchyName && (0, _type.isNumeric)(field.groupIndex)) {
return
}(0, _iterator.each)(filterValues, function(_, filterValue) {
var filterMdx = dataField + "." + preparePathValue(Array.isArray(filterValue) ? filterValue[filterValue.length - 1] : filterValue, dataField);
if ("exclude" === field.filterType) {
filterExpression.push(filterMdx + ".parent");
filterMdx = "Descendants(" + filterMdx + ")"
}
filterExpression.push(filterMdx)
});
if (filterValues.length) {
filterStringExpression = (0, _string.format)(mdxSet, filterExpression.join(","));
if ("exclude" === field.filterType) {
filterStringExpression = "Except(" + getAllMembers(field) + "," + filterStringExpression + ")"
}
filterMembers.push(filterStringExpression)
}
});
return filterMembers.length ? crossJoinElements(filterMembers) : ""
}
function generateFrom(columnsFilter, rowsFilter, filter, cubeName) {
var from = "[" + cubeName + "]";
(0, _iterator.each)([columnsFilter, rowsFilter, filter], function(_, filter) {
if (filter) {
from = (0, _string.format)(mdxFilterSelect, filter + "on 0", from)
}
});
return from
}
function generateMdxCore(axisStrings, withArray, columns, rows, filters, slice, cubeName) {
var options = arguments.length > 7 && void 0 !== arguments[7] ? arguments[7] : {};
var mdxString = "",
withString = (withArray.length ? "with " + withArray.join(" ") : "") + " ";
if (axisStrings.length) {
var select = void 0;
if (options.totalsOnly) {
var countMembers = [];
if (rows.length) {
countMembers.push("[DX_rows_count]")
}
if (columns.length) {
countMembers.push("[DX_columns_count]")
}
select = "{" + countMembers.join(",") + "} on columns"
} else {
select = axisStrings.join(",")
}
mdxString = withString + (0, _string.format)(mdx, generateFrom(generateAxisFieldsFilter(columns), generateAxisFieldsFilter(rows), generateAxisFieldsFilter(filters || []), cubeName), slice.length ? (0, _string.format)(mdxSlice, slice.join(",")) : "", select)
}
return mdxString
}
function prepareDataFields(withArray, valueFields) {
return (0, _iterator.map)(valueFields, function(cell) {
if ((0, _type.isString)(cell.expression)) {
declare(cell.expression, withArray, cell.dataField, "member")
}
return cell.dataField
})
}
function addSlices(slices, options, headerName, path) {
(0, _iterator.each)(path, function(index, value) {
var dimension = options[headerName][index];
if (!dimension.hierarchyName || dimension.hierarchyName !== options[headerName][index + 1].hierarchyName) {
slices.push(dimension.dataField + "." + preparePathValue(value, dimension.dataField))
}
})
}
function generateMDX(options, cubeName, parseOptions) {
var columns = options.columns || [],
rows = options.rows || [],
values = options.values && options.values.length ? options.values : [{
dataField: "[Measures]"
}],
slice = [],
withArray = [],
axisStrings = [],
dataFields = prepareDataFields(withArray, values);
parseOptions.measureCount = options.skipValues ? 1 : values.length;
parseOptions.visibleLevels = {};
if (options.headerName && options.path) {
addSlices(slice, options, options.headerName, options.path)
}
if (options.headerName && options.oppositePath) {
addSlices(slice, options, "rows" === options.headerName ? "columns" : "rows", options.oppositePath)
}
if (columns.length || dataFields.length) {
axisStrings.push(generateAxisMdx(options, "columns", dataFields, withArray, parseOptions))
}
if (rows.length) {
axisStrings.push(generateAxisMdx(options, "rows", dataFields, withArray, parseOptions))
}
return generateMdxCore(axisStrings, withArray, columns, rows, options.filters, slice, cubeName, options)
}
function createDrillDownAxisSlice(slice, fields, path) {
(0, _iterator.each)(path, function(index, value) {
var field = fields[index];
if (field.hierarchyName && (fields[index + 1] || {}).hierarchyName === field.hierarchyName) {
return
}
slice.push(field.dataField + "." + preparePathValue(value, field.dataField))
})
}
function generateDrillDownMDX(options, cubeName, params) {
var coreMDX, columns = options.columns || [],
rows = options.rows || [],
values = options.values && options.values.length ? options.values : [{
dataField: "[Measures]"
}],
slice = [],
withArray = [],
axisStrings = [],
dataFields = prepareDataFields(withArray, values),
maxRowCount = params.maxRowCount,
customColumns = params.customColumns || [],
customColumnsString = customColumns.length > 0 ? " return " + customColumns.join(",") : "";
createDrillDownAxisSlice(slice, columns, params.columnPath || []);
createDrillDownAxisSlice(slice, rows, params.rowPath || []);
if (columns.length || columns.length || dataFields.length) {
axisStrings.push([(dataFields[params.dataIndex] || dataFields[0]) + " on 0"])
}
coreMDX = generateMdxCore(axisStrings, withArray, columns, rows, options.filters, slice, cubeName);
return coreMDX ? "drillthrough" + (maxRowCount > 0 ? " maxrows " + maxRowCount : "") + coreMDX + customColumnsString : coreMDX
}
function getNumber(str) {
return parseInt(str, 10)
}
function parseValue(valueText) {
return (0, _type.isNumeric)(valueText) ? parseFloat(valueText) : valueText
}
function getFirstChild(node, tagName) {
return (node.getElementsByTagName(tagName) || [])[0]
}
function getFirstChildText(node, childTagName) {
return getNodeText(getFirstChild(node, childTagName))
}
function parseAxes(xml, skipValues) {
var axes = [];
(0, _iterator.each)(xml.getElementsByTagName("Axis"), function(_, axisElement) {
var name = axisElement.getAttribute("name"),
axis = [],
index = 0;
if (0 === name.indexOf("Axis") && (0, _type.isNumeric)(getNumber(name.substr(4)))) {
axes.push(axis);
(0, _iterator.each)(axisElement.getElementsByTagName("Tuple"), function(_, tupleElement) {
var tuple, level, i, tupleMembers = tupleElement.childNodes,
levelSum = 0,
members = [],
membersCount = skipValues ? tupleMembers.length : tupleMembers.length - 1,
isAxisWithMeasure = 1 === axes.length;
if (isAxisWithMeasure) {
membersCount--
}
axis.push(members);
for (i = membersCount; i >= 0; i--) {
tuple = tupleMembers[i];
level = getNumber(getFirstChildText(tuple, "LNum"));
members[i] = {
caption: getFirstChildText(tuple, "Caption"),
value: parseValue(getFirstChildText(tuple, "MEMBER_VALUE")),
level: level,
index: index++,
hasValue: !levelSum && (!!level || 0 === i),
name: getFirstChildText(tuple, "UName"),
hierarchyName: tupleMembers[i].getAttribute("Hierarchy"),
parentName: getFirstChildText(tuple, "PARENT_UNIQUE_NAME"),
levelName: getFirstChildText(tuple, "LName")
};
levelSum += level
}
})
}
});
while (axes.length < 2) {
axes.push([
[{
level: 0
}]
])
}
return axes
}
function getNodeText(node) {
return node && node && (node.textContent || node.text || node.innerHTML) || ""
}
function parseCells(xml, axes, measureCount) {
var measureIndex, row, cells = [],
cell = [],
index = 0,
cellsOriginal = [],
cellElements = xml.getElementsByTagName("Cell"),
errorDictionary = {};
for (var i = 0; i < cellElements.length; i++) {
var xmlCell = cellElements[i],
valueElement = xmlCell.getElementsByTagName("Value")[0],
errorElements = valueElement && valueElement.getElementsByTagName("Error") || [],
text = 0 === errorElements.length ? getNodeText(valueElement) : "#N/A",
value = parseFloat(text),
isNumeric = text - value + 1 > 0,
cellOrdinal = getNumber(xmlCell.getAttribute("CellOrdinal"));
if (errorElements.length) {
errorDictionary[getNodeText(errorElements[0].getElementsByTagName("ErrorCode")[0])] = getNodeText(errorElements[0].getElementsByTagName("Description")[0])
}
cellsOriginal[cellOrdinal] = {
value: isNumeric ? value : text || null
}
}(0, _iterator.each)(axes[1], function() {
row = [];
cells.push(row);
(0, _iterator.each)(axes[0], function() {
measureIndex = index % measureCount;
if (0 === measureIndex) {
cell = [];
row.push(cell)
}
cell.push(cellsOriginal[index] ? cellsOriginal[index].value : null);
index++
})
});
Object.keys(errorDictionary).forEach(function(key) {
_errors.errors.log("W4002", errorDictionary[key])
});
return cells
}
function preparePathValue(pathValue, dataField) {
if (pathValue) {
pathValue = (0, _type.isString)(pathValue) && pathValue.indexOf("&") !== -1 ? pathValue : "[" + pathValue + "]";
if (dataField && 0 === pathValue.indexOf(dataField + ".")) {
pathValue = pathValue.slice(dataField.length + 1, pathValue.length)
}
}
return pathValue
}
function getItem(hash, name, member, index) {
var item = hash[name];
if (!item) {
item = {};
hash[name] = item
}
if (!(0, _type.isDefined)(item.value) && member) {
item.text = member.caption;
item.value = member.value;
item.key = name ? name : "";
item.levelName = member.levelName;
item.hierarchyName = member.hierarchyName;
item.parentName = member.parentName;
item.index = index;
item.level = member.level
}
return item
}
function getVisibleChildren(item, visibleLevels) {
var result = [],
children = item.children && (item.children.length ? item.children : Object.keys(item.children.grandTotalHash || {}).reduce(function(result, name) {
return result.concat(item.children.grandTotalHash[name].children)
}, [])),
firstChild = children && children[0];
if (firstChild && (visibleLevels[firstChild.hierarchyName] && (0, _array.inArray)(firstChild.levelName, visibleLevels[firstChild.hierarchyName]) !== -1 || !visibleLevels[firstChild.hierarchyName] || 0 === firstChild.level)) {
var newChildren = children.filter(function(child) {
return child.hierarchyName === firstChild.hierarchyName
});
newChildren.grandTotalHash = children.grandTotalHash;
return newChildren
} else {
if (firstChild) {
for (var i = 0; i < children.length; i++) {
if (children[i].hierarchyName === firstChild.hierarchyName) {
result.push.apply(result, getVisibleChildren(children[i], visibleLevels))
}
}
}
}
return result
}
function processMember(dataIndex, member, parentItem) {
var currentItem, children = parentItem.children = parentItem.children || [],
hash = children.hash = children.hash || {},
grandTotalHash = children.grandTotalHash = children.grandTotalHash || {};
if (member.parentName) {
parentItem = getItem(hash, member.parentName);
children = parentItem.children = parentItem.children || []
}
currentItem = getItem(hash, member.name, member, dataIndex);
if (member.hasValue && !currentItem.added) {
currentItem.index = dataIndex;
currentItem.added = true;
children.push(currentItem)
}
if ((!parentItem.value || !parentItem.parentName) && member.parentName) {
grandTotalHash[member.parentName] = parentItem
} else {
if (grandTotalHash[parentItem.name]) {
delete grandTotalHash[member.parentName]
}
}
return currentItem
}
function getGrandTotalIndex(parentItem, visibleLevels) {
var grandTotalIndex;
if (1 === parentItem.children.length && "" === parentItem.children[0].parentName) {
grandTotalIndex = parentItem.children[0].index;
var grandTotalHash = parentItem.children.grandTotalHash;
parentItem.children = parentItem.children[0].children || [];
parentItem.children.grandTotalHash = grandTotalHash;
parentItem.children = getVisibleChildren(parentItem, visibleLevels)
} else {
if (0 === parentItem.children.length) {
grandTotalIndex = 0
}
}
return grandTotalIndex
}
function fillDataSourceAxes(dataSourceAxis, axisTuples, measureCount, visibleLevels) {
var grandTotalIndex, result = [];
(0, _iterator.each)(axisTuples, function(tupleIndex, members) {
var parentItem = {
children: result
},
dataIndex = (0, _type.isDefined)(measureCount) ? Math.floor(tupleIndex / measureCount) : tupleIndex;
(0, _iterator.each)(members, function(_, member) {
parentItem = processMember(dataIndex, member, parentItem)
})
});
var parentItem = {
children: result
};
parentItem.children = getVisibleChildren(parentItem, visibleLevels);
grandTotalIndex = getGrandTotalIndex(parentItem, visibleLevels);
(0, _uiPivot_grid.foreachTree)(parentItem.children, function(items) {
var item = items[0],
children = getVisibleChildren(item, visibleLevels);
if (children.length) {
item.children = children
} else {
delete item.children
}
delete item.levelName;
delete item.hierarchyName;
delete item.added;
delete item.parentName;
delete item.level
}, true);
(0, _iterator.each)(parentItem.children || [], function(_, e) {
dataSourceAxis.push(e)
});
return grandTotalIndex
}
function checkError(xml) {
var description, error, faultElementNS = xml.getElementsByTagName("soap:Fault"),
faultElement = xml.getElementsByTagName("Fault"),
errorElement = (0, _renderer2.default)([].slice.call(faultElement.length ? faultElement : faultElementNS)).find("Error");
if (errorElement.length) {
description = errorElement.attr("Description");
error = new _errors.errors.Error("E4000", description);
_errors.errors.log("E4000", description);
return error
}
return null
}
function parseResult(xml, parseOptions) {
var axes, dataSource = {
columns: [],
rows: []
},
measureCount = parseOptions.measureCount;
axes = parseAxes(xml, parseOptions.skipValues);
dataSource.grandTotalColumnIndex = fillDataSourceAxes(dataSource.columns, axes[0], measureCount, parseOptions.visibleLevels);
dataSource.grandTotalRowIndex = fillDataSourceAxes(dataSource.rows, axes[1], void 0, parseOptions.visibleLevels);
dataSource.values = parseCells(xml, axes, measureCount);
return dataSource
}
function parseDiscoverRowSet(xml, schema, dimensions, translatedDisplayFolders) {
var result = [],
isMeasure = "MEASURE" === schema,
displayFolderField = isMeasure ? "MEASUREGROUP_NAME" : schema + "_DISPLAY_FOLDER";
(0, _iterator.each)(xml.getElementsByTagName("row"), function(_, row) {
var hierarchyName = "LEVEL" === schema ? getFirstChildText(row, "HIERARCHY_UNIQUE_NAME") : void 0,
levelNumber = getFirstChildText(row, "LEVEL_NUMBER"),
displayFolder = getFirstChildText(row, displayFolderField);
if (isMeasure) {
displayFolder = translatedDisplayFolders[displayFolder] || displayFolder
}
if (("0" !== levelNumber || "true" !== getFirstChildText(row, schema + "_IS_VISIBLE")) && getFirstChildText(row, "DIMENSION_TYPE") !== MD_DIMTYPE_MEASURE) {
var dimension = isMeasure ? MEASURE_DEMENSION_KEY : getFirstChildText(row, "DIMENSION_UNIQUE_NAME"),
dataField = getFirstChildText(row, schema + "_UNIQUE_NAME");
result.push({
dimension: dimensions.names[dimension] || dimension,
groupIndex: levelNumber ? getNumber(levelNumber) - 1 : void 0,
dataField: dataField,
caption: getFirstChildText(row, schema + "_CAPTION"),
hierarchyName: hierarchyName,
groupName: hierarchyName,
displayFolder: displayFolder,
isMeasure: isMeasure,
isDefault: !!dimensions.defaultHierarchies[dataField]
})
}
});
return result
}
function parseMeasureGroupDiscoverRowSet(xml) {
var measureGroups = {};
(0, _iterator.each)(xml.getElementsByTagName("row"), function(_, row) {
measureGroups[getFirstChildText(row, "MEASUREGROUP_NAME")] = getFirstChildText(row, "MEASUREGROUP_CAPTION")
});
return measureGroups
}
function parseDimensionsDiscoverRowSet(xml) {
var result = {
names: {},
defaultHierarchies: {}
};
(0, _iterator.each)((0, _renderer2.default)(xml).find("row"), function() {
var $row = (0, _renderer2.default)(this),
type = $row.children("DIMENSION_TYPE").text(),
dimensionName = type === MD_DIMTYPE_MEASURE ? MEASURE_DEMENSION_KEY : $row.children("DIMENSION_UNIQUE_NAME").text();
result.names[dimensionName] = $row.children("DIMENSION_CAPTION").text();
result.defaultHierarchies[$row.children("DEFAULT_HIERARCHY").text()] = true
});
return result
}
function parseStringWithUnicodeSymbols(str) {
str = str.replace(/_x(....)_/g, function(whole, group1) {
return String.fromCharCode(parseInt(group1, 16))
});
var stringArray = str.match(/\[.+?\]/gi);
if (stringArray && stringArray.length) {
str = stringArray[stringArray.length - 1]
}
return str.replace(/\[/gi, "").replace(/\]/gi, "").replace(/\$/gi, "").replace(/\./gi, " ")
}
function parseDrillDownRowSet(xml) {
var rows = xml.getElementsByTagName("row"),
result = [],
columnNames = {};
for (var i = 0; i < rows.length; i++) {
var children = rows[i].childNodes,
item = {};
for (var j = 0; j < children.length; j++) {
var tagName = children[j].tagName,
name = columnNames[tagName] = columnNames[tagName] || parseStringWithUnicodeSymbols(tagName);
item[name] = getNodeText(children[j])
}
result.push(item)
}
return result
}
function sendQuery(storeOptions, mdxString) {
mdxString = (0, _renderer2.default)("<div>").text(mdxString).html();
return execXMLA(storeOptions, (0, _string.format)(execute, mdxString, storeOptions.catalog, getLocaleIdProperty()))
}
function processTotalCount(data, options, totalCountXml) {
var axes = [];
var columnOptions = options.columns || [];
var rowOptions = options.rows || [];
if (columnOptions.length) {
axes.push({})
}
if (rowOptions.length) {
axes.push({})
}
var cells = parseCells(totalCountXml, [
[{}],
[{}, {}]
], 1);
if (!columnOptions.length && rowOptions.length) {
data.rowCount = Math.max(cells[0][0][0] - 1, 0)
}
if (!rowOptions.length && columnOptions.length) {
data.columnCount = Math.max(cells[0][0][0] - 1, 0)
}
if (rowOptions.length && columnOptions.length) {
data.rowCount = Math.max(cells[0][0][0] - 1, 0);
data.columnCount = Math.max(cells[1][0][0] - 1, 0)
}
if (void 0 !== data.rowCount && options.rowTake) {
data.rows = [].concat(_toConsumableArray(Array(options.rowSkip))).concat(data.rows);
data.rows.length = data.rowCount;
for (var i = 0; i < data.rows.length; i++) {
data.rows[i] = data.rows[i] || {}
}
}
if (void 0 !== data.columnCount && options.columnTake) {
data.columns = [].concat(_toConsumableArray(Array(options.columnSkip))).concat(data.columns);
data.columns.length = data.columnCount;
for (var _i = 0; _i < data.columns.length; _i++) {
data.columns[_i] = data.columns[_i] || {}
}
}
}
return {
ctor: function(options) {
this._options = options
},
getFields: function() {
var options = this._options,
catalog = options.catalog,
cube = options.cube,
localeIdProperty = getLocaleIdProperty(),
dimensionsRequest = execXMLA(options, (0, _string.format)(discover, catalog, cube, "MDSCHEMA_DIMENSIONS", localeIdProperty)),
measuresRequest = execXMLA(options, (0, _string.format)(discover, catalog, cube, "MDSCHEMA_MEASURES", localeIdProperty)),
hierarchiesRequest = execXMLA(options, (0, _string.format)(discover, catalog, cube, "MDSCHEMA_HIERARCHIES", localeIdProperty)),
levelsRequest = execXMLA(options, (0, _string.format)(discover, catalog, cube, "MDSCHEMA_LEVELS", localeIdProperty)),
result = new _deferred.Deferred;
(0, _deferred.when)(dimensionsRequest, measuresRequest, hierarchiesRequest, levelsRequest).then(function(dimensionsResponse, measuresResponse, hierarchiesResponse, levelsResponse) {
execXMLA(options, (0, _string.format)(discover, catalog, cube, "MDSCHEMA_MEASUREGROUPS", localeIdProperty)).done(function(measureGroupsResponse) {
var dimensions = parseDimensionsDiscoverRowSet(dimensionsResponse),
hierarchies = parseDiscoverRowSet(hierarchiesResponse, "HIERARCHY", dimensions),
levels = parseDiscoverRowSet(levelsResponse, "LEVEL", dimensions),
measureGroups = parseMeasureGroupDiscoverRowSet(measureGroupsResponse),
fields = parseDiscoverRowSet(measuresResponse, "MEASURE", dimensions, measureGroups).concat(hierarchies),
levelsByHierarchy = {};
(0, _iterator.each)(levels, function(_, level) {
levelsByHierarchy[level.hierarchyName] = levelsByHierarchy[level.hierarchyName] || [];
levelsByHierarchy[level.hierarchyName].push(level)
});
(0, _iterator.each)(hierarchies, function(_, hierarchy) {
if (levelsByHierarchy[hierarchy.dataField] && levelsByHierarchy[hierarchy.dataField].length > 1) {
hierarchy.groupName = hierarchy.hierarchyName = hierarchy.dataField;
fields.push.apply(fields, levelsByHierarchy[hierarchy.hierarchyName])
}
});
result.resolve(fields)
}).fail(result.reject)
}).fail(result.reject);
return result
},
load: function load(options) {
var result = new _deferred.Deferred,
storeOptions = this._options,
parseOptions = {
skipValues: options.skipValues
},
mdxString = generateMDX(options, storeOptions.cube, parseOptions);
var rowCountMdx = void 0;
if (options.rowSkip || options.rowTake || options.columnTake || options.columnSkip) {
rowCountMdx = generateMDX((0, _extend.extend)({}, options, {
totalsOnly: true,
rowSkip: null,
rowTake: null,
columnSkip: null,
columnTake: null
}), storeOptions.cube, {})
}
var load = function() {
if (mdxString) {
(0, _deferred.when)(sendQuery(storeOptions, mdxString), rowCountMdx && sendQuery(storeOptions, rowCountMdx)).done(function(executeXml, rowCountXml) {
var error = checkError(executeXml) || rowCountXml && checkError(rowCountXml);
if (!error) {
var response = parseResult(executeXml, parseOptions);
if (rowCountXml) {
processTotalCount(response, options, rowCountXml)
}
result.resolve(response)
} else {
result.reject(error)
}
}).fail(result.reject)
} else {
result.resolve({
columns: [],
rows: [],
values: [],
grandTotalColumnIndex: 0,
grandTotalRowIndex: 0
})
}
};
if (options.delay) {
setTimeout(load, options.delay)
} else {
load()
}
return result
},
supportPaging: function() {
return true
},
getDrillDownItems: function(options, params) {
var result = new _deferred.Deferred,
storeOptions = this._options,
mdxString = generateDrillDownMDX(options, storeOptions.cube, params);
if (mdxString) {
(0, _deferred.when)(sendQuery(storeOptions, mdxString)).done(function(executeXml) {
var error = checkError(executeXml);
if (!error) {
result.resolve(parseDrillDownRowSet(executeXml))
} else {
result.reject(error)
}
}).fail(result.reject)
} else {
result.resolve([])
}
return result
},
key: _common.noop,
filter: _common.noop
}
}()).include(_uiPivot_grid.storeDrillDownMixin);
|
// Exporting an object containing all of our models
module.exports = {
// YOUR CODE GOES HERE
User: require("./User")
};
|
var NAVTREE =
[
[ "devcfg", "index.html", [
[ "Data Structures", null, [
[ "Data Structures", "annotated.html", null ],
[ "Data Fields", "functions.html", [
[ "All", "functions.html", null ],
[ "Variables", "functions_vars.html", null ]
] ]
] ],
[ "APIs", "globals.html", [
[ "All", "globals.html", null ],
[ "Functions", "globals_func.html", null ],
[ "Variables", "globals_vars.html", null ],
[ "Typedefs", "globals_type.html", null ],
[ "Macros", "globals_defs.html", null ]
] ],
[ "File List", "files.html", "files" ],
[ "Examples", "example.html", [
[ "xdevcfg_selftest_example.c", "example.html#ex1", null ],
[ "xdevcfg_interrupt_example.c", "example.html#ex2", null ],
[ "xdevcfg_polled_example.c", "example.html#ex3", null ],
[ "xdevcfg_reg_readback_example.c", "example.html#ex4", null ]
] ]
] ]
];
var NAVTREEINDEX =
[
"annotated.html"
];
var SYNCONMSG = 'click to disable panel synchronisation';
var SYNCOFFMSG = 'click to enable panel synchronisation';
var navTreeSubIndices = new Array();
function getData(varName)
{
var i = varName.lastIndexOf('/');
var n = i>=0 ? varName.substring(i+1) : varName;
return eval(n.replace(/\-/g,'_'));
}
function stripPath(uri)
{
return uri.substring(uri.lastIndexOf('/')+1);
}
function stripPath2(uri)
{
var i = uri.lastIndexOf('/');
var s = uri.substring(i+1);
var m = uri.substring(0,i+1).match(/\/d\w\/d\w\w\/$/);
return m ? uri.substring(i-6) : s;
}
function localStorageSupported()
{
try {
return 'localStorage' in window && window['localStorage'] !== null && window.localStorage.getItem;
}
catch(e) {
return false;
}
}
function storeLink(link)
{
if (!$("#nav-sync").hasClass('sync') && localStorageSupported()) {
window.localStorage.setItem('navpath',link);
}
}
function deleteLink()
{
if (localStorageSupported()) {
window.localStorage.setItem('navpath','');
}
}
function cachedLink()
{
if (localStorageSupported()) {
return window.localStorage.getItem('navpath');
} else {
return '';
}
}
function getScript(scriptName,func,show)
{
var head = document.getElementsByTagName("head")[0];
var script = document.createElement('script');
script.id = scriptName;
script.type = 'text/javascript';
script.onload = func;
script.src = scriptName+'.js';
if ($.browser.msie && $.browser.version<=8) {
// script.onload does not work with older versions of IE
script.onreadystatechange = function() {
if (script.readyState=='complete' || script.readyState=='loaded') {
func(); if (show) showRoot();
}
}
}
head.appendChild(script);
}
function createIndent(o,domNode,node,level)
{
var level=-1;
var n = node;
while (n.parentNode) { level++; n=n.parentNode; }
var imgNode = document.createElement("img");
imgNode.style.paddingLeft=(16*level).toString()+'px';
imgNode.width = 16;
imgNode.height = 22;
imgNode.border = 0;
if (node.childrenData) {
node.plus_img = imgNode;
node.expandToggle = document.createElement("a");
node.expandToggle.href = "javascript:void(0)";
node.expandToggle.onclick = function() {
if (node.expanded) {
$(node.getChildrenUL()).slideUp("fast");
node.plus_img.src = node.relpath+"ftv2pnode.png";
node.expanded = false;
} else {
expandNode(o, node, false, false);
}
}
node.expandToggle.appendChild(imgNode);
domNode.appendChild(node.expandToggle);
imgNode.src = node.relpath+"ftv2pnode.png";
} else {
imgNode.src = node.relpath+"ftv2node.png";
domNode.appendChild(imgNode);
}
}
var animationInProgress = false;
function gotoAnchor(anchor,aname,updateLocation)
{
var pos, docContent = $('#doc-content');
if (anchor.parent().attr('class')=='memItemLeft' ||
anchor.parent().attr('class')=='fieldtype' ||
anchor.parent().is(':header'))
{
pos = anchor.parent().position().top;
} else if (anchor.position()) {
pos = anchor.position().top;
}
if (pos) {
var dist = Math.abs(Math.min(
pos-docContent.offset().top,
docContent[0].scrollHeight-
docContent.height()-docContent.scrollTop()));
animationInProgress=true;
docContent.animate({
scrollTop: pos + docContent.scrollTop() - docContent.offset().top
},Math.max(50,Math.min(500,dist)),function(){
if (updateLocation) window.location.href=aname;
animationInProgress=false;
});
}
}
function newNode(o, po, text, link, childrenData, lastNode)
{
var node = new Object();
node.children = Array();
node.childrenData = childrenData;
node.depth = po.depth + 1;
node.relpath = po.relpath;
node.isLast = lastNode;
node.li = document.createElement("li");
po.getChildrenUL().appendChild(node.li);
node.parentNode = po;
node.itemDiv = document.createElement("div");
node.itemDiv.className = "item";
node.labelSpan = document.createElement("span");
node.labelSpan.className = "label";
createIndent(o,node.itemDiv,node,0);
node.itemDiv.appendChild(node.labelSpan);
node.li.appendChild(node.itemDiv);
var a = document.createElement("a");
node.labelSpan.appendChild(a);
node.label = document.createTextNode(text);
node.expanded = false;
a.appendChild(node.label);
if (link) {
var url;
if (link.substring(0,1)=='^') {
url = link.substring(1);
link = url;
} else {
url = node.relpath+link;
}
a.className = stripPath(link.replace('#',':'));
if (link.indexOf('#')!=-1) {
var aname = '#'+link.split('#')[1];
var srcPage = stripPath($(location).attr('pathname'));
var targetPage = stripPath(link.split('#')[0]);
a.href = srcPage!=targetPage ? url : "javascript:void(0)";
a.onclick = function(){
storeLink(link);
if (!$(a).parent().parent().hasClass('selected'))
{
$('.item').removeClass('selected');
$('.item').removeAttr('id');
$(a).parent().parent().addClass('selected');
$(a).parent().parent().attr('id','selected');
}
var anchor = $(aname);
gotoAnchor(anchor,aname,true);
};
} else {
a.href = url;
a.onclick = function() { storeLink(link); }
}
} else {
if (childrenData != null)
{
a.className = "nolink";
a.href = "javascript:void(0)";
a.onclick = node.expandToggle.onclick;
}
}
node.childrenUL = null;
node.getChildrenUL = function() {
if (!node.childrenUL) {
node.childrenUL = document.createElement("ul");
node.childrenUL.className = "children_ul";
node.childrenUL.style.display = "none";
node.li.appendChild(node.childrenUL);
}
return node.childrenUL;
};
return node;
}
function showRoot()
{
var headerHeight = $("#top").height();
var footerHeight = $("#nav-path").height();
var windowHeight = $(window).height() - headerHeight - footerHeight;
(function (){ // retry until we can scroll to the selected item
try {
var navtree=$('#nav-tree');
navtree.scrollTo('#selected',0,{offset:-windowHeight/2});
} catch (err) {
setTimeout(arguments.callee, 0);
}
})();
}
function expandNode(o, node, imm, showRoot)
{
if (node.childrenData && !node.expanded) {
if (typeof(node.childrenData)==='string') {
var varName = node.childrenData;
getScript(node.relpath+varName,function(){
node.childrenData = getData(varName);
expandNode(o, node, imm, showRoot);
}, showRoot);
} else {
if (!node.childrenVisited) {
getNode(o, node);
} if (imm || ($.browser.msie && $.browser.version>8)) {
// somehow slideDown jumps to the start of tree for IE9 :-(
$(node.getChildrenUL()).show();
} else {
$(node.getChildrenUL()).slideDown("fast");
}
if (node.isLast) {
node.plus_img.src = node.relpath+"ftv2mlastnode.png";
} else {
node.plus_img.src = node.relpath+"ftv2mnode.png";
}
node.expanded = true;
}
}
}
function glowEffect(n,duration)
{
n.addClass('glow').delay(duration).queue(function(next){
$(this).removeClass('glow');next();
});
}
function highlightAnchor()
{
var aname = $(location).attr('hash');
var anchor = $(aname);
if (anchor.parent().attr('class')=='memItemLeft'){
var rows = $('.memberdecls tr[class$="'+
window.location.hash.substring(1)+'"]');
glowEffect(rows.children(),300); // member without details
} else if (anchor.parents().slice(2).prop('tagName')=='TR') {
glowEffect(anchor.parents('div.memitem'),1000); // enum value
} else if (anchor.parent().attr('class')=='fieldtype'){
glowEffect(anchor.parent().parent(),1000); // struct field
} else if (anchor.parent().is(":header")) {
glowEffect(anchor.parent(),1000); // section header
} else {
glowEffect(anchor.next(),1000); // normal member
}
gotoAnchor(anchor,aname,false);
}
function selectAndHighlight(hash,n)
{
var a;
if (hash) {
var link=stripPath($(location).attr('pathname'))+':'+hash.substring(1);
a=$('.item a[class$="'+link+'"]');
}
if (a && a.length) {
a.parent().parent().addClass('selected');
a.parent().parent().attr('id','selected');
highlightAnchor();
} else if (n) {
$(n.itemDiv).addClass('selected');
$(n.itemDiv).attr('id','selected');
}
if ($('#nav-tree-contents .item:first').hasClass('selected')) {
$('#nav-sync').css('top','30px');
} else {
$('#nav-sync').css('top','5px');
}
showRoot();
}
function showNode(o, node, index, hash)
{
if (node && node.childrenData) {
if (typeof(node.childrenData)==='string') {
var varName = node.childrenData;
getScript(node.relpath+varName,function(){
node.childrenData = getData(varName);
showNode(o,node,index,hash);
},true);
} else {
if (!node.childrenVisited) {
getNode(o, node);
}
$(node.getChildrenUL()).show();
if (node.isLast) {
node.plus_img.src = node.relpath+"ftv2mlastnode.png";
} else {
node.plus_img.src = node.relpath+"ftv2mnode.png";
}
node.expanded = true;
var n = node.children[o.breadcrumbs[index]];
if (index+1<o.breadcrumbs.length) {
showNode(o,n,index+1,hash);
} else {
if (typeof(n.childrenData)==='string') {
var varName = n.childrenData;
getScript(n.relpath+varName,function(){
n.childrenData = getData(varName);
node.expanded=false;
showNode(o,node,index,hash); // retry with child node expanded
},true);
} else {
var rootBase = stripPath(o.toroot.replace(/\..+$/, ''));
if (rootBase=="index" || rootBase=="pages" || rootBase=="search") {
expandNode(o, n, true, true);
}
selectAndHighlight(hash,n);
}
}
}
} else {
selectAndHighlight(hash);
}
}
function getNode(o, po)
{
po.childrenVisited = true;
var l = po.childrenData.length-1;
for (var i in po.childrenData) {
var nodeData = po.childrenData[i];
po.children[i] = newNode(o, po, nodeData[0], nodeData[1], nodeData[2],
i==l);
}
}
function gotoNode(o,subIndex,root,hash,relpath)
{
var nti = navTreeSubIndices[subIndex][root+hash];
o.breadcrumbs = $.extend(true, [], nti ? nti : navTreeSubIndices[subIndex][root]);
if (!o.breadcrumbs && root!=NAVTREE[0][1]) { // fallback: show index
navTo(o,NAVTREE[0][1],"",relpath);
$('.item').removeClass('selected');
$('.item').removeAttr('id');
}
if (o.breadcrumbs) {
o.breadcrumbs.unshift(0); // add 0 for root node
showNode(o, o.node, 0, hash);
}
}
function navTo(o,root,hash,relpath)
{
var link = cachedLink();
if (link) {
var parts = link.split('#');
root = parts[0];
if (parts.length>1) hash = '#'+parts[1];
else hash='';
}
if (hash.match(/^#l\d+$/)) {
var anchor=$('a[name='+hash.substring(1)+']');
glowEffect(anchor.parent(),1000); // line number
hash=''; // strip line number anchors
//root=root.replace(/_source\./,'.'); // source link to doc link
}
var url=root+hash;
var i=-1;
while (NAVTREEINDEX[i+1]<=url) i++;
if (i==-1) { i=0; root=NAVTREE[0][1]; } // fallback: show index
if (navTreeSubIndices[i]) {
gotoNode(o,i,root,hash,relpath)
} else {
getScript(relpath+'navtreeindex'+i,function(){
navTreeSubIndices[i] = eval('NAVTREEINDEX'+i);
if (navTreeSubIndices[i]) {
gotoNode(o,i,root,hash,relpath);
}
},true);
}
}
function showSyncOff(n,relpath)
{
n.html('<img src="'+relpath+'sync_off.png" title="'+SYNCOFFMSG+'"/>');
}
function showSyncOn(n,relpath)
{
n.html('<img src="'+relpath+'sync_on.png" title="'+SYNCONMSG+'"/>');
}
function toggleSyncButton(relpath)
{
var navSync = $('#nav-sync');
if (navSync.hasClass('sync')) {
navSync.removeClass('sync');
showSyncOff(navSync,relpath);
storeLink(stripPath2($(location).attr('pathname'))+$(location).attr('hash'));
} else {
navSync.addClass('sync');
showSyncOn(navSync,relpath);
deleteLink();
}
}
function initNavTree(toroot,relpath)
{
var o = new Object();
o.toroot = toroot;
o.node = new Object();
o.node.li = document.getElementById("nav-tree-contents");
o.node.childrenData = NAVTREE;
o.node.children = new Array();
o.node.childrenUL = document.createElement("ul");
o.node.getChildrenUL = function() { return o.node.childrenUL; };
o.node.li.appendChild(o.node.childrenUL);
o.node.depth = 0;
o.node.relpath = relpath;
o.node.expanded = false;
o.node.isLast = true;
o.node.plus_img = document.createElement("img");
o.node.plus_img.src = relpath+"ftv2pnode.png";
o.node.plus_img.width = 16;
o.node.plus_img.height = 22;
if (localStorageSupported()) {
var navSync = $('#nav-sync');
if (cachedLink()) {
showSyncOff(navSync,relpath);
navSync.removeClass('sync');
} else {
showSyncOn(navSync,relpath);
}
navSync.click(function(){ toggleSyncButton(relpath); });
}
navTo(o,toroot,window.location.hash,relpath);
$(window).bind('hashchange', function(){
if (window.location.hash && window.location.hash.length>1){
var a;
if ($(location).attr('hash')){
var clslink=stripPath($(location).attr('pathname'))+':'+
$(location).attr('hash').substring(1);
a=$('.item a[class$="'+clslink+'"]');
}
if (a==null || !$(a).parent().parent().hasClass('selected')){
$('.item').removeClass('selected');
$('.item').removeAttr('id');
}
var link=stripPath2($(location).attr('pathname'));
navTo(o,link,$(location).attr('hash'),relpath);
} else if (!animationInProgress) {
$('#doc-content').scrollTop(0);
$('.item').removeClass('selected');
$('.item').removeAttr('id');
navTo(o,toroot,window.location.hash,relpath);
}
})
$(window).load(showRoot);
}
|
$.browser.chrome = /chrome/.test(navigator.userAgent.toLowerCase());
$.browser.ipad = /ipad/.test(navigator.userAgent.toLowerCase());
/**
* Initializes page contents for progressive enhancement.
*/
function initializeContents()
{
// hide all more buttons because they are not needed with JS
$(".element a.more").hide();
$(".clickable.class,.clickable.interface").click(function() {
document.location = $(this).attr('href');
});
// change the cursor to a pointer to make it more explicit that this it clickable
// do a background color change on hover to emphasize the clickability eveb more
// we do not use CSS for this because when JS is disabled this behaviour does not
// apply and we do not want the hover
$(".element.method,.element.function,.element.class.clickable,.element.interface.clickable")
.css("cursor", "pointer")
.hover(function() {
$(this).css('backgroundColor', '#F8FDF6')
}, function(){
$(this).css('backgroundColor', 'white')}
);
// do not show tooltips on iPad; it will cause the user having to click twice
if (!$.browser.ipad) {
$('.btn-group.visibility,.btn-group.view,.btn-group.type-filter')
.tooltip({'placement':'bottom'});
}
$('.btn-group.visibility,.btn-group.view,.btn-group.type-filter')
.show()
.find('button')
.find('i').click(function(){ $(this).parent().click(); });
// set the events for the visibility buttons and enable by default.
$('.visibility button.public').click(function(){
$('.element.public,.side-nav li.public').toggle($(this).hasClass('active'));
}).click();
$('.visibility button.protected').click(function(){
$('.element.protected,.side-nav li.protected').toggle($(this).hasClass('active'));
}).click();
$('.visibility button.private').click(function(){
$('.element.private,.side-nav li.private').toggle($(this).hasClass('active'));
}).click();
$('.visibility button.inherited').click(function(){
$('.element.inherited,.side-nav li.inherited').toggle($(this).hasClass('active'));
}).click();
$('.type-filter button.critical').click(function(){
$('tr.critical').toggle($(this).hasClass('active'));
});
$('.type-filter button.error').click(function(){
$('tr.error').toggle($(this).hasClass('active'));
});
$('.type-filter button.notice').click(function(){
$('tr.notice').toggle($(this).hasClass('active'));
});
$('.view button.details').click(function(){
$('.side-nav li.view-simple').removeClass('view-simple');
}).button('toggle').click();
$('.view button.details').click(function(){
$('.side-nav li.view-simple').removeClass('view-simple');
}).button('toggle').click();
$('.view button.simple').click(function(){
$('.side-nav li').addClass('view-simple');
});
}
$(document).ready(function() {
prettyPrint();
initializeContents();
// do not show tooltips on iPad; it will cause the user having to click twice
if(!$.browser.ipad) {
$(".side-nav a").tooltip({'placement': 'top'});
}
$('ul.nav-namespaces li a, ul.nav-packages li a').click(function(){
// Google Chrome does not do Ajax locally
if ($.browser.chrome && (window.location.protocol == 'file:'))
{
return true;
}
$(this).parents('.side-nav').find('.active').removeClass('active');
$(this).parent().addClass('active');
$('div.namespace-contents').load(
this.href + ' div.namespace-contents', function(){
initializeContents();
$(window).scrollTop($('div.namespace-contents').position().top);
}
);
$('div.package-contents').load(
this.href + ' div.package-contents', function(){
initializeContents();
$(window).scrollTop($('div.package-contents').position().top);
}
);
return false;
});
function filterPath(string)
{
return string
.replace(/^\//, '')
.replace(/(index|default).[a-zA-Z]{3,4}$/, '')
.replace(/\/$/, '');
}
var locationPath = filterPath(location.pathname);
// the ipad already smoothly scrolls and does not detect the scrollable
// element if top=0; as such we disable this behaviour for the iPad
if (!$.browser.ipad) {
$('a[href*=#]').each(function ()
{
var thisPath = filterPath(this.pathname) || locationPath;
if (locationPath == thisPath && (location.hostname == this.hostname || !this.hostname) && this.hash.replace(/#/, ''))
{
var $target = $(this.hash), target = this.hash;
if ($target.length > 0)
{
$(this).click(function (event)
{
var scrollElem = scrollableElement('html', 'body');
var targetOffset = $target.offset().top;
event.preventDefault();
$(scrollElem).animate({scrollTop:targetOffset}, 400, function ()
{
location.hash = target;
});
});
}
}
});
}
// use the first element that is "scrollable"
function scrollableElement(els)
{
for (var i = 0, argLength = arguments.length; i < argLength; i++)
{
var el = arguments[i], $scrollElement = $(el);
if ($scrollElement.scrollTop() > 0)
{
return el;
}
else
{
$scrollElement.scrollTop(1);
var isScrollable = $scrollElement.scrollTop() > 0;
$scrollElement.scrollTop(0);
if (isScrollable)
{
return el;
}
}
}
return [];
}
});
|
// Copyright 2021 ARKADEEP
//
// 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.
|
// Variables Globals
var messages = {};
// Add requires libraries
var express = require('express');
var mongojs = require('mongojs');
var bodyParser = require('body-parser');
var fs = require('fs');
var isJSON = require('is-json');
var empty = require('is-empty');
var validatorJsonSchema = require('jsonschema').Validator;
var rulesJsonSchema = require('./config/rules_json_schema/main');
var validDataRules = require('./config/rules_json_schema/valid_data');
//Use Libraries
var app = express();
var db = mongojs('inferenciadortest', ['inferenciadortest']);
// App.Use express Static Folders
app.use(express.static('config'));
app.use(express.static('node_modules'));
app.use(express.static('public'));
app.use(express.static('tests'));
app.use(express.static('controllers'));
app.use(bodyParser.json());
// Config message of the system
app.get('/messages', function (req, res) {
messages = rulesJsonSchema.messages();
res.end(JSON.stringify( messages ));
});
// App.Set Jade
app.set('view engine','jade');
// Inicially Routes of the system
app.get('/', function (req, res) {
res.render('index');
});
app.get('/addRuleView', function (req, res) {
res.render('addRule');
});
app.get('/inferenciador', function (req, res) {
res.render('inferenciador');
});
app.post('/testinferenciador', function (req, res) {
req.body.id = 'validate';
postAndUpdate(req,res);
});
//-------------------------------------- CRUD INFERENCIADOR -----------------------------------------
//---------------------- GET and POST -------------------------
app.get('/inferenciadorlist', function (req, res) {
db.inferenciadortest.find(function (err, docs) {
res.status(200).json(docs);
});
});
app.post('/inferenciadorlist', function (req, res) {
postAndUpdate(req,res);
});
function postAndUpdate (req, res) {
var validatorObject = new validatorJsonSchema();
var json = req.body.json;
var id = req.body.id;
var responseMessages;
var ruleSchema1 = rulesJsonSchema.configMainRule1();
var ruleSchema2 = rulesJsonSchema.configMainRule2();
var responseValidatorJsonSchema1 = validatorObject.validate(json, ruleSchema1);
var responseValidatorJsonSchema2 = validatorObject.validate(json, ruleSchema2);
if(!empty(responseValidatorJsonSchema1.errors) && empty(responseValidatorJsonSchema2.errors)){
return getDataJson(json, res, id);
}else{
validDataRules.responseJSONError(responseValidatorJsonSchema2.errors, messages);
}
if(empty(responseValidatorJsonSchema1.errors) && !empty(responseValidatorJsonSchema2.errors)){
return getDataJson(json, res, id);
}else{
validDataRules.responseJSONError(responseValidatorJsonSchema1.errors, messages);
}
res.status(400).json(messages.errors.variable_structure); // Send Error
}
function getDataJson (json, res, id) {
var condition_general = json.condition.type;
var jsonInputs = json.condition.inputs[0];
// Call Validation For Build the condition
var condition = validDataRules.validRuleData(jsonInputs, condition_general, messages, empty);
var response = {
'name' : json.name,
'condition' : condition,
'jsoneditor' : JSON.stringify(json)
};
if(id == 'undefined'){ // Create Rule
db.inferenciadortest.insert(response, function(err, doc) {
return res.status(200).end('OK');
});
}else if(id == 'validate'){
return res.status(200).json(response);
}
else{ // Update Rule
db.inferenciadortest.findAndModify({
query: {
_id: mongojs.ObjectId(id)
},
update: {
$set: response
},
new: true
},
function (err, doc) {
return res.status(200).end('OK');
}
);
}
}
//---------------------- EDIT -------------------------
app.get('/addRuleView/:id', function (req, res) {
var params;
var id = req.params.id;
db.inferenciadortest.findOne({_id: mongojs.ObjectId(id)}, function (err, doc) {
res.render('addRule',doc);
});
});
//---------------------- DELETE -------------------------
app.delete('/inferenciadorlist', function (req, res) {
var id = req.body.id;
db.inferenciadortest.remove({_id: mongojs.ObjectId(id)}, function (err, doc) {
return res.status(200).end('OK');
});
});
messages = rulesJsonSchema.messages();
app.listen(6700);
console.log("Servidor corriendo para el puerto 6700");
|
import { useQuery, useMutation } from '@apollo/client'
import { Button } from '@mui/material'
import React, { Fragment, useState } from 'react'
import DeleteTransaction from '../gql/deleteTransaction.gql'
import GetTransactions from '../gql/transactions.gql'
import { TxTable } from '../components/transactions/TxTable'
import { TransactionModal } from '../components/transactions/TransactionModal'
export function Home () {
const [isTxModalOpen, setIsTxModalOpen] = useState(false)
const [selectedTransaction, setSelectedTransaction] = useState()
const { loading, error, data = {}, refetch } = useQuery(GetTransactions)
const [ deleteTransaction ] = useMutation(DeleteTransaction, {
refetchQueries: [
'GetTransactions'
]
})
const handleAdd = () => {
setSelectedTransaction()
setIsTxModalOpen(true)
}
const handleDelete = (id) => {
deleteTransaction({
variables: {
id
}
})
}
const handleEdit = (tx) => {
setSelectedTransaction(tx)
setIsTxModalOpen(true)
}
const handleCloseDialog = () => {
setIsTxModalOpen(false)
setSelectedTransaction()
}
if (loading) {
return (
<Fragment>
Loading...
</Fragment>
)
}
if (error) {
return (
<Fragment>
¯\_(ツ)_/¯
</Fragment>
)
}
return (
<Fragment>
<TxTable data={data.transactions} deleteTransaction={handleDelete} editTransaction={handleEdit} />
<Button onClick={handleAdd}>Add Transaction</Button>
<TransactionModal
close={handleCloseDialog}
open={isTxModalOpen}
refreshTable={refetch}
transaction={selectedTransaction}
/>
</Fragment>
)
}
|
/*
* 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.
*/
angular.module('dashboard')
.directive('alertsTable', function () {
'use strict';
return {
restrict: 'E',
templateUrl: 'views/apps/app/alerts_table.html',
replace: false /* true will got an error */,
scope: {
alerts: '=alertsBind'
},
controller: ['$scope', '$sortableTableBuilder',
function ($scope, $stb) {
$scope.table = {
cols: [
$stb.indicator().key('severity').canSort().styleClass('td-no-padding').done(),
$stb.datetime('Time').key('time').canSort().sortDefault().styleClass('col-xs-4').done(),
$stb.text('Message').key('message').canSort().styleClass('col-xs-8').done()
],
rows: null
};
var severityLookup = {
error: {text: 'Error', condition: 'danger'},
warning: {text: 'Warning', condition: 'concern'}
};
function updateTable(alerts) {
$scope.table.rows = $stb.$update($scope.table.rows,
_.map(alerts, function (alert) {
var severity = severityLookup[alert.severity];
return {
severity: {
tooltip: severity.text,
condition: severity.condition,
shape: 'stripe'
},
time: alert.time,
message: alert.message
};
}));
}
$scope.$watch('alerts', function (alerts) {
updateTable(alerts);
});
}]
};
})
;
|
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
/*! For license information please see jsencrypt.min.js.LICENSE.txt */
!function (t, e) {
"object" == (typeof exports === "undefined" ? "undefined" : _typeof(exports)) && "object" == (typeof module === "undefined" ? "undefined" : _typeof(module)) ? module.exports = e() : "function" == typeof define && define.amd ? define([], e) : "object" == (typeof exports === "undefined" ? "undefined" : _typeof(exports)) ? exports.JSEncrypt = e() : t.JSEncrypt = e();
}(window, function () {
return function () {
"use strict";
var t = [, function (t, e, i) {
function r(t) {
return "0123456789abcdefghijklmnopqrstuvwxyz".charAt(t);
}
function n(t, e) {
return t & e;
}
function s(t, e) {
return t | e;
}
function o(t, e) {
return t ^ e;
}
function h(t, e) {
return t & ~e;
}
function a(t) {
if (0 == t) return -1;
var e = 0;
return 0 == (65535 & t) && (t >>= 16, e += 16), 0 == (255 & t) && (t >>= 8, e += 8), 0 == (15 & t) && (t >>= 4, e += 4), 0 == (3 & t) && (t >>= 2, e += 2), 0 == (1 & t) && ++e, e;
}
function u(t) {
for (var e = 0; 0 != t;) {
t &= t - 1, ++e;
}
return e;
}
i.d(e, {
"default": function _default() {
return nt;
}
});
var c,
f = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
function l(t) {
var e,
i,
r = "";
for (e = 0; e + 3 <= t.length; e += 3) {
i = parseInt(t.substring(e, e + 3), 16), r += f.charAt(i >> 6) + f.charAt(63 & i);
}
for (e + 1 == t.length ? (i = parseInt(t.substring(e, e + 1), 16), r += f.charAt(i << 2)) : e + 2 == t.length && (i = parseInt(t.substring(e, e + 2), 16), r += f.charAt(i >> 2) + f.charAt((3 & i) << 4)); (3 & r.length) > 0;) {
r += "=";
}
return r;
}
function p(t) {
var e,
i = "",
n = 0,
s = 0;
for (e = 0; e < t.length && "=" != t.charAt(e); ++e) {
var o = f.indexOf(t.charAt(e));
o < 0 || (0 == n ? (i += r(o >> 2), s = 3 & o, n = 1) : 1 == n ? (i += r(s << 2 | o >> 4), s = 15 & o, n = 2) : 2 == n ? (i += r(s), i += r(o >> 2), s = 3 & o, n = 3) : (i += r(s << 2 | o >> 4), i += r(15 & o), n = 0));
}
return 1 == n && (i += r(s << 2)), i;
}
var g,
d = {
decode: function decode(t) {
var e;
if (void 0 === g) {
var i = "= \f\n\r\t \u2028\u2029";
for (g = Object.create(null), e = 0; e < 64; ++e) {
g["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e)] = e;
}
for (g["-"] = 62, g._ = 63, e = 0; e < i.length; ++e) {
g[i.charAt(e)] = -1;
}
}
var r = [],
n = 0,
s = 0;
for (e = 0; e < t.length; ++e) {
var o = t.charAt(e);
if ("=" == o) break;
if (-1 != (o = g[o])) {
if (void 0 === o) throw new Error("Illegal character at offset " + e);
n |= o, ++s >= 4 ? (r[r.length] = n >> 16, r[r.length] = n >> 8 & 255, r[r.length] = 255 & n, n = 0, s = 0) : n <<= 6;
}
}
switch (s) {
case 1:
throw new Error("Base64 encoding incomplete: at least 2 bits missing");
case 2:
r[r.length] = n >> 10;
break;
case 3:
r[r.length] = n >> 16, r[r.length] = n >> 8 & 255;
}
return r;
},
re: /-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,
unarmor: function unarmor(t) {
var e = d.re.exec(t);
if (e) if (e[1]) t = e[1];else {
if (!e[2]) throw new Error("RegExp out of sync");
t = e[2];
}
return d.decode(t);
}
},
v = 1e13,
m = function () {
function t(t) {
this.buf = [+t || 0];
}
return t.prototype.mulAdd = function (t, e) {
var i,
r,
n = this.buf,
s = n.length;
for (i = 0; i < s; ++i) {
(r = n[i] * t + e) < v ? e = 0 : r -= (e = 0 | r / v) * v, n[i] = r;
}
e > 0 && (n[i] = e);
}, t.prototype.sub = function (t) {
var e,
i,
r = this.buf,
n = r.length;
for (e = 0; e < n; ++e) {
(i = r[e] - t) < 0 ? (i += v, t = 1) : t = 0, r[e] = i;
}
for (; 0 === r[r.length - 1];) {
r.pop();
}
}, t.prototype.toString = function (t) {
if (10 != (t || 10)) throw new Error("only base 10 is supported");
for (var e = this.buf, i = e[e.length - 1].toString(), r = e.length - 2; r >= 0; --r) {
i += (v + e[r]).toString().substring(1);
}
return i;
}, t.prototype.valueOf = function () {
for (var t = this.buf, e = 0, i = t.length - 1; i >= 0; --i) {
e = e * v + t[i];
}
return e;
}, t.prototype.simplify = function () {
var t = this.buf;
return 1 == t.length ? t[0] : this;
}, t;
}(),
y = /^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,
b = /^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;
function T(t, e) {
return t.length > e && (t = t.substring(0, e) + "…"), t;
}
var S,
E = function () {
function t(e, i) {
this.hexDigits = "0123456789ABCDEF", e instanceof t ? (this.enc = e.enc, this.pos = e.pos) : (this.enc = e, this.pos = i);
}
return t.prototype.get = function (t) {
if (void 0 === t && (t = this.pos++), t >= this.enc.length) throw new Error("Requesting byte offset " + t + " on a stream of length " + this.enc.length);
return "string" == typeof this.enc ? this.enc.charCodeAt(t) : this.enc[t];
}, t.prototype.hexByte = function (t) {
return this.hexDigits.charAt(t >> 4 & 15) + this.hexDigits.charAt(15 & t);
}, t.prototype.hexDump = function (t, e, i) {
for (var r = "", n = t; n < e; ++n) {
if (r += this.hexByte(this.get(n)), !0 !== i) switch (15 & n) {
case 7:
r += " ";
break;
case 15:
r += "\n";
break;
default:
r += " ";
}
}
return r;
}, t.prototype.isASCII = function (t, e) {
for (var i = t; i < e; ++i) {
var r = this.get(i);
if (r < 32 || r > 176) return !1;
}
return !0;
}, t.prototype.parseStringISO = function (t, e) {
for (var i = "", r = t; r < e; ++r) {
i += String.fromCharCode(this.get(r));
}
return i;
}, t.prototype.parseStringUTF = function (t, e) {
for (var i = "", r = t; r < e;) {
var n = this.get(r++);
i += n < 128 ? String.fromCharCode(n) : n > 191 && n < 224 ? String.fromCharCode((31 & n) << 6 | 63 & this.get(r++)) : String.fromCharCode((15 & n) << 12 | (63 & this.get(r++)) << 6 | 63 & this.get(r++));
}
return i;
}, t.prototype.parseStringBMP = function (t, e) {
for (var i, r, n = "", s = t; s < e;) {
i = this.get(s++), r = this.get(s++), n += String.fromCharCode(i << 8 | r);
}
return n;
}, t.prototype.parseTime = function (t, e, i) {
var r = this.parseStringISO(t, e),
n = (i ? y : b).exec(r);
return n ? (i && (n[1] = +n[1], n[1] += +n[1] < 70 ? 2e3 : 1900), r = n[1] + "-" + n[2] + "-" + n[3] + " " + n[4], n[5] && (r += ":" + n[5], n[6] && (r += ":" + n[6], n[7] && (r += "." + n[7]))), n[8] && (r += " UTC", "Z" != n[8] && (r += n[8], n[9] && (r += ":" + n[9]))), r) : "Unrecognized time: " + r;
}, t.prototype.parseInteger = function (t, e) {
for (var i, r = this.get(t), n = r > 127, s = n ? 255 : 0, o = ""; r == s && ++t < e;) {
r = this.get(t);
}
if (0 == (i = e - t)) return n ? -1 : 0;
if (i > 4) {
for (o = r, i <<= 3; 0 == (128 & (+o ^ s));) {
o = +o << 1, --i;
}
o = "(" + i + " bit)\n";
}
n && (r -= 256);
for (var h = new m(r), a = t + 1; a < e; ++a) {
h.mulAdd(256, this.get(a));
}
return o + h.toString();
}, t.prototype.parseBitString = function (t, e, i) {
for (var r = this.get(t), n = "(" + ((e - t - 1 << 3) - r) + " bit)\n", s = "", o = t + 1; o < e; ++o) {
for (var h = this.get(o), a = o == e - 1 ? r : 0, u = 7; u >= a; --u) {
s += h >> u & 1 ? "1" : "0";
}
if (s.length > i) return n + T(s, i);
}
return n + s;
}, t.prototype.parseOctetString = function (t, e, i) {
if (this.isASCII(t, e)) return T(this.parseStringISO(t, e), i);
var r = e - t,
n = "(" + r + " byte)\n";
r > (i /= 2) && (e = t + i);
for (var s = t; s < e; ++s) {
n += this.hexByte(this.get(s));
}
return r > i && (n += "…"), n;
}, t.prototype.parseOID = function (t, e, i) {
for (var r = "", n = new m(), s = 0, o = t; o < e; ++o) {
var h = this.get(o);
if (n.mulAdd(128, 127 & h), s += 7, !(128 & h)) {
if ("" === r) {
if ((n = n.simplify()) instanceof m) n.sub(80), r = "2." + n.toString();else {
var a = n < 80 ? n < 40 ? 0 : 1 : 2;
r = a + "." + (n - 40 * a);
}
} else r += "." + n.toString();
if (r.length > i) return T(r, i);
n = new m(), s = 0;
}
}
return s > 0 && (r += ".incomplete"), r;
}, t;
}(),
w = function () {
function t(t, e, i, r, n) {
if (!(r instanceof D)) throw new Error("Invalid tag value.");
this.stream = t, this.header = e, this.length = i, this.tag = r, this.sub = n;
}
return t.prototype.typeName = function () {
switch (this.tag.tagClass) {
case 0:
switch (this.tag.tagNumber) {
case 0:
return "EOC";
case 1:
return "BOOLEAN";
case 2:
return "INTEGER";
case 3:
return "BIT_STRING";
case 4:
return "OCTET_STRING";
case 5:
return "NULL";
case 6:
return "OBJECT_IDENTIFIER";
case 7:
return "ObjectDescriptor";
case 8:
return "EXTERNAL";
case 9:
return "REAL";
case 10:
return "ENUMERATED";
case 11:
return "EMBEDDED_PDV";
case 12:
return "UTF8String";
case 16:
return "SEQUENCE";
case 17:
return "SET";
case 18:
return "NumericString";
case 19:
return "PrintableString";
case 20:
return "TeletexString";
case 21:
return "VideotexString";
case 22:
return "IA5String";
case 23:
return "UTCTime";
case 24:
return "GeneralizedTime";
case 25:
return "GraphicString";
case 26:
return "VisibleString";
case 27:
return "GeneralString";
case 28:
return "UniversalString";
case 30:
return "BMPString";
}
return "Universal_" + this.tag.tagNumber.toString();
case 1:
return "Application_" + this.tag.tagNumber.toString();
case 2:
return "[" + this.tag.tagNumber.toString() + "]";
case 3:
return "Private_" + this.tag.tagNumber.toString();
}
}, t.prototype.content = function (t) {
if (void 0 === this.tag) return null;
void 0 === t && (t = 1 / 0);
var e = this.posContent(),
i = Math.abs(this.length);
if (!this.tag.isUniversal()) return null !== this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseOctetString(e, e + i, t);
switch (this.tag.tagNumber) {
case 1:
return 0 === this.stream.get(e) ? "false" : "true";
case 2:
return this.stream.parseInteger(e, e + i);
case 3:
return this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseBitString(e, e + i, t);
case 4:
return this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseOctetString(e, e + i, t);
case 6:
return this.stream.parseOID(e, e + i, t);
case 16:
case 17:
return null !== this.sub ? "(" + this.sub.length + " elem)" : "(no elem)";
case 12:
return T(this.stream.parseStringUTF(e, e + i), t);
case 18:
case 19:
case 20:
case 21:
case 22:
case 26:
return T(this.stream.parseStringISO(e, e + i), t);
case 30:
return T(this.stream.parseStringBMP(e, e + i), t);
case 23:
case 24:
return this.stream.parseTime(e, e + i, 23 == this.tag.tagNumber);
}
return null;
}, t.prototype.toString = function () {
return this.typeName() + "@" + this.stream.pos + "[header:" + this.header + ",length:" + this.length + ",sub:" + (null === this.sub ? "null" : this.sub.length) + "]";
}, t.prototype.toPrettyString = function (t) {
void 0 === t && (t = "");
var e = t + this.typeName() + " @" + this.stream.pos;
if (this.length >= 0 && (e += "+"), e += this.length, this.tag.tagConstructed ? e += " (constructed)" : !this.tag.isUniversal() || 3 != this.tag.tagNumber && 4 != this.tag.tagNumber || null === this.sub || (e += " (encapsulates)"), e += "\n", null !== this.sub) {
t += " ";
for (var i = 0, r = this.sub.length; i < r; ++i) {
e += this.sub[i].toPrettyString(t);
}
}
return e;
}, t.prototype.posStart = function () {
return this.stream.pos;
}, t.prototype.posContent = function () {
return this.stream.pos + this.header;
}, t.prototype.posEnd = function () {
return this.stream.pos + this.header + Math.abs(this.length);
}, t.prototype.toHexString = function () {
return this.stream.hexDump(this.posStart(), this.posEnd(), !0);
}, t.decodeLength = function (t) {
var e = t.get(),
i = 127 & e;
if (i == e) return i;
if (i > 6) throw new Error("Length over 48 bits not supported at position " + (t.pos - 1));
if (0 === i) return null;
e = 0;
for (var r = 0; r < i; ++r) {
e = 256 * e + t.get();
}
return e;
}, t.prototype.getHexStringValue = function () {
var t = this.toHexString(),
e = 2 * this.header,
i = 2 * this.length;
return t.substr(e, i);
}, t.decode = function (e) {
var i;
i = e instanceof E ? e : new E(e, 0);
var r = new E(i),
n = new D(i),
s = t.decodeLength(i),
o = i.pos,
h = o - r.pos,
a = null,
u = function u() {
var e = [];
if (null !== s) {
for (var r = o + s; i.pos < r;) {
e[e.length] = t.decode(i);
}
if (i.pos != r) throw new Error("Content size is not correct for container starting at offset " + o);
} else try {
for (;;) {
var n = t.decode(i);
if (n.tag.isEOC()) break;
e[e.length] = n;
}
s = o - i.pos;
} catch (t) {
throw new Error("Exception while decoding undefined length content: " + t);
}
return e;
};
if (n.tagConstructed) a = u();else if (n.isUniversal() && (3 == n.tagNumber || 4 == n.tagNumber)) try {
if (3 == n.tagNumber && 0 != i.get()) throw new Error("BIT STRINGs with unused bits cannot encapsulate.");
a = u();
for (var c = 0; c < a.length; ++c) {
if (a[c].tag.isEOC()) throw new Error("EOC is not supposed to be actual content.");
}
} catch (t) {
a = null;
}
if (null === a) {
if (null === s) throw new Error("We can't skip over an invalid tag with undefined length at offset " + o);
i.pos = o + Math.abs(s);
}
return new t(r, h, s, n, a);
}, t;
}(),
D = function () {
function t(t) {
var e = t.get();
if (this.tagClass = e >> 6, this.tagConstructed = 0 != (32 & e), this.tagNumber = 31 & e, 31 == this.tagNumber) {
var i = new m();
do {
e = t.get(), i.mulAdd(128, 127 & e);
} while (128 & e);
this.tagNumber = i.simplify();
}
}
return t.prototype.isUniversal = function () {
return 0 === this.tagClass;
}, t.prototype.isEOC = function () {
return 0 === this.tagClass && 0 === this.tagNumber;
}, t;
}(),
x = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997],
R = (1 << 26) / x[x.length - 1],
B = function () {
function t(t, e, i) {
null != t && ("number" == typeof t ? this.fromNumber(t, e, i) : null == e && "string" != typeof t ? this.fromString(t, 256) : this.fromString(t, e));
}
return t.prototype.toString = function (t) {
if (this.s < 0) return "-" + this.negate().toString(t);
var e;
if (16 == t) e = 4;else if (8 == t) e = 3;else if (2 == t) e = 1;else if (32 == t) e = 5;else {
if (4 != t) return this.toRadix(t);
e = 2;
}
var i,
n = (1 << e) - 1,
s = !1,
o = "",
h = this.t,
a = this.DB - h * this.DB % e;
if (h-- > 0) for (a < this.DB && (i = this[h] >> a) > 0 && (s = !0, o = r(i)); h >= 0;) {
a < e ? (i = (this[h] & (1 << a) - 1) << e - a, i |= this[--h] >> (a += this.DB - e)) : (i = this[h] >> (a -= e) & n, a <= 0 && (a += this.DB, --h)), i > 0 && (s = !0), s && (o += r(i));
}
return s ? o : "0";
}, t.prototype.negate = function () {
var e = N();
return t.ZERO.subTo(this, e), e;
}, t.prototype.abs = function () {
return this.s < 0 ? this.negate() : this;
}, t.prototype.compareTo = function (t) {
var e = this.s - t.s;
if (0 != e) return e;
var i = this.t;
if (0 != (e = i - t.t)) return this.s < 0 ? -e : e;
for (; --i >= 0;) {
if (0 != (e = this[i] - t[i])) return e;
}
return 0;
}, t.prototype.bitLength = function () {
return this.t <= 0 ? 0 : this.DB * (this.t - 1) + F(this[this.t - 1] ^ this.s & this.DM);
}, t.prototype.mod = function (e) {
var i = N();
return this.abs().divRemTo(e, null, i), this.s < 0 && i.compareTo(t.ZERO) > 0 && e.subTo(i, i), i;
}, t.prototype.modPowInt = function (t, e) {
var i;
return i = t < 256 || e.isEven() ? new A(e) : new V(e), this.exp(t, i);
}, t.prototype.clone = function () {
var t = N();
return this.copyTo(t), t;
}, t.prototype.intValue = function () {
if (this.s < 0) {
if (1 == this.t) return this[0] - this.DV;
if (0 == this.t) return -1;
} else {
if (1 == this.t) return this[0];
if (0 == this.t) return 0;
}
return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0];
}, t.prototype.byteValue = function () {
return 0 == this.t ? this.s : this[0] << 24 >> 24;
}, t.prototype.shortValue = function () {
return 0 == this.t ? this.s : this[0] << 16 >> 16;
}, t.prototype.signum = function () {
return this.s < 0 ? -1 : this.t <= 0 || 1 == this.t && this[0] <= 0 ? 0 : 1;
}, t.prototype.toByteArray = function () {
var t = this.t,
e = [];
e[0] = this.s;
var i,
r = this.DB - t * this.DB % 8,
n = 0;
if (t-- > 0) for (r < this.DB && (i = this[t] >> r) != (this.s & this.DM) >> r && (e[n++] = i | this.s << this.DB - r); t >= 0;) {
r < 8 ? (i = (this[t] & (1 << r) - 1) << 8 - r, i |= this[--t] >> (r += this.DB - 8)) : (i = this[t] >> (r -= 8) & 255, r <= 0 && (r += this.DB, --t)), 0 != (128 & i) && (i |= -256), 0 == n && (128 & this.s) != (128 & i) && ++n, (n > 0 || i != this.s) && (e[n++] = i);
}
return e;
}, t.prototype.equals = function (t) {
return 0 == this.compareTo(t);
}, t.prototype.min = function (t) {
return this.compareTo(t) < 0 ? this : t;
}, t.prototype.max = function (t) {
return this.compareTo(t) > 0 ? this : t;
}, t.prototype.and = function (t) {
var e = N();
return this.bitwiseTo(t, n, e), e;
}, t.prototype.or = function (t) {
var e = N();
return this.bitwiseTo(t, s, e), e;
}, t.prototype.xor = function (t) {
var e = N();
return this.bitwiseTo(t, o, e), e;
}, t.prototype.andNot = function (t) {
var e = N();
return this.bitwiseTo(t, h, e), e;
}, t.prototype.not = function () {
for (var t = N(), e = 0; e < this.t; ++e) {
t[e] = this.DM & ~this[e];
}
return t.t = this.t, t.s = ~this.s, t;
}, t.prototype.shiftLeft = function (t) {
var e = N();
return t < 0 ? this.rShiftTo(-t, e) : this.lShiftTo(t, e), e;
}, t.prototype.shiftRight = function (t) {
var e = N();
return t < 0 ? this.lShiftTo(-t, e) : this.rShiftTo(t, e), e;
}, t.prototype.getLowestSetBit = function () {
for (var t = 0; t < this.t; ++t) {
if (0 != this[t]) return t * this.DB + a(this[t]);
}
return this.s < 0 ? this.t * this.DB : -1;
}, t.prototype.bitCount = function () {
for (var t = 0, e = this.s & this.DM, i = 0; i < this.t; ++i) {
t += u(this[i] ^ e);
}
return t;
}, t.prototype.testBit = function (t) {
var e = Math.floor(t / this.DB);
return e >= this.t ? 0 != this.s : 0 != (this[e] & 1 << t % this.DB);
}, t.prototype.setBit = function (t) {
return this.changeBit(t, s);
}, t.prototype.clearBit = function (t) {
return this.changeBit(t, h);
}, t.prototype.flipBit = function (t) {
return this.changeBit(t, o);
}, t.prototype.add = function (t) {
var e = N();
return this.addTo(t, e), e;
}, t.prototype.subtract = function (t) {
var e = N();
return this.subTo(t, e), e;
}, t.prototype.multiply = function (t) {
var e = N();
return this.multiplyTo(t, e), e;
}, t.prototype.divide = function (t) {
var e = N();
return this.divRemTo(t, e, null), e;
}, t.prototype.remainder = function (t) {
var e = N();
return this.divRemTo(t, null, e), e;
}, t.prototype.divideAndRemainder = function (t) {
var e = N(),
i = N();
return this.divRemTo(t, e, i), [e, i];
}, t.prototype.modPow = function (t, e) {
var i,
r,
n = t.bitLength(),
s = C(1);
if (n <= 0) return s;
i = n < 18 ? 1 : n < 48 ? 3 : n < 144 ? 4 : n < 768 ? 5 : 6, r = n < 8 ? new A(e) : e.isEven() ? new I(e) : new V(e);
var o = [],
h = 3,
a = i - 1,
u = (1 << i) - 1;
if (o[1] = r.convert(this), i > 1) {
var c = N();
for (r.sqrTo(o[1], c); h <= u;) {
o[h] = N(), r.mulTo(c, o[h - 2], o[h]), h += 2;
}
}
var f,
l,
p = t.t - 1,
g = !0,
d = N();
for (n = F(t[p]) - 1; p >= 0;) {
for (n >= a ? f = t[p] >> n - a & u : (f = (t[p] & (1 << n + 1) - 1) << a - n, p > 0 && (f |= t[p - 1] >> this.DB + n - a)), h = i; 0 == (1 & f);) {
f >>= 1, --h;
}
if ((n -= h) < 0 && (n += this.DB, --p), g) o[f].copyTo(s), g = !1;else {
for (; h > 1;) {
r.sqrTo(s, d), r.sqrTo(d, s), h -= 2;
}
h > 0 ? r.sqrTo(s, d) : (l = s, s = d, d = l), r.mulTo(d, o[f], s);
}
for (; p >= 0 && 0 == (t[p] & 1 << n);) {
r.sqrTo(s, d), l = s, s = d, d = l, --n < 0 && (n = this.DB - 1, --p);
}
}
return r.revert(s);
}, t.prototype.modInverse = function (e) {
var i = e.isEven();
if (this.isEven() && i || 0 == e.signum()) return t.ZERO;
for (var r = e.clone(), n = this.clone(), s = C(1), o = C(0), h = C(0), a = C(1); 0 != r.signum();) {
for (; r.isEven();) {
r.rShiftTo(1, r), i ? (s.isEven() && o.isEven() || (s.addTo(this, s), o.subTo(e, o)), s.rShiftTo(1, s)) : o.isEven() || o.subTo(e, o), o.rShiftTo(1, o);
}
for (; n.isEven();) {
n.rShiftTo(1, n), i ? (h.isEven() && a.isEven() || (h.addTo(this, h), a.subTo(e, a)), h.rShiftTo(1, h)) : a.isEven() || a.subTo(e, a), a.rShiftTo(1, a);
}
r.compareTo(n) >= 0 ? (r.subTo(n, r), i && s.subTo(h, s), o.subTo(a, o)) : (n.subTo(r, n), i && h.subTo(s, h), a.subTo(o, a));
}
return 0 != n.compareTo(t.ONE) ? t.ZERO : a.compareTo(e) >= 0 ? a.subtract(e) : a.signum() < 0 ? (a.addTo(e, a), a.signum() < 0 ? a.add(e) : a) : a;
}, t.prototype.pow = function (t) {
return this.exp(t, new O());
}, t.prototype.gcd = function (t) {
var e = this.s < 0 ? this.negate() : this.clone(),
i = t.s < 0 ? t.negate() : t.clone();
if (e.compareTo(i) < 0) {
var r = e;
e = i, i = r;
}
var n = e.getLowestSetBit(),
s = i.getLowestSetBit();
if (s < 0) return e;
for (n < s && (s = n), s > 0 && (e.rShiftTo(s, e), i.rShiftTo(s, i)); e.signum() > 0;) {
(n = e.getLowestSetBit()) > 0 && e.rShiftTo(n, e), (n = i.getLowestSetBit()) > 0 && i.rShiftTo(n, i), e.compareTo(i) >= 0 ? (e.subTo(i, e), e.rShiftTo(1, e)) : (i.subTo(e, i), i.rShiftTo(1, i));
}
return s > 0 && i.lShiftTo(s, i), i;
}, t.prototype.isProbablePrime = function (t) {
var e,
i = this.abs();
if (1 == i.t && i[0] <= x[x.length - 1]) {
for (e = 0; e < x.length; ++e) {
if (i[0] == x[e]) return !0;
}
return !1;
}
if (i.isEven()) return !1;
for (e = 1; e < x.length;) {
for (var r = x[e], n = e + 1; n < x.length && r < R;) {
r *= x[n++];
}
for (r = i.modInt(r); e < n;) {
if (r % x[e++] == 0) return !1;
}
}
return i.millerRabin(t);
}, t.prototype.copyTo = function (t) {
for (var e = this.t - 1; e >= 0; --e) {
t[e] = this[e];
}
t.t = this.t, t.s = this.s;
}, t.prototype.fromInt = function (t) {
this.t = 1, this.s = t < 0 ? -1 : 0, t > 0 ? this[0] = t : t < -1 ? this[0] = t + this.DV : this.t = 0;
}, t.prototype.fromString = function (e, i) {
var r;
if (16 == i) r = 4;else if (8 == i) r = 3;else if (256 == i) r = 8;else if (2 == i) r = 1;else if (32 == i) r = 5;else {
if (4 != i) return void this.fromRadix(e, i);
r = 2;
}
this.t = 0, this.s = 0;
for (var n = e.length, s = !1, o = 0; --n >= 0;) {
var h = 8 == r ? 255 & +e[n] : H(e, n);
h < 0 ? "-" == e.charAt(n) && (s = !0) : (s = !1, 0 == o ? this[this.t++] = h : o + r > this.DB ? (this[this.t - 1] |= (h & (1 << this.DB - o) - 1) << o, this[this.t++] = h >> this.DB - o) : this[this.t - 1] |= h << o, (o += r) >= this.DB && (o -= this.DB));
}
8 == r && 0 != (128 & +e[0]) && (this.s = -1, o > 0 && (this[this.t - 1] |= (1 << this.DB - o) - 1 << o)), this.clamp(), s && t.ZERO.subTo(this, this);
}, t.prototype.clamp = function () {
for (var t = this.s & this.DM; this.t > 0 && this[this.t - 1] == t;) {
--this.t;
}
}, t.prototype.dlShiftTo = function (t, e) {
var i;
for (i = this.t - 1; i >= 0; --i) {
e[i + t] = this[i];
}
for (i = t - 1; i >= 0; --i) {
e[i] = 0;
}
e.t = this.t + t, e.s = this.s;
}, t.prototype.drShiftTo = function (t, e) {
for (var i = t; i < this.t; ++i) {
e[i - t] = this[i];
}
e.t = Math.max(this.t - t, 0), e.s = this.s;
}, t.prototype.lShiftTo = function (t, e) {
for (var i = t % this.DB, r = this.DB - i, n = (1 << r) - 1, s = Math.floor(t / this.DB), o = this.s << i & this.DM, h = this.t - 1; h >= 0; --h) {
e[h + s + 1] = this[h] >> r | o, o = (this[h] & n) << i;
}
for (h = s - 1; h >= 0; --h) {
e[h] = 0;
}
e[s] = o, e.t = this.t + s + 1, e.s = this.s, e.clamp();
}, t.prototype.rShiftTo = function (t, e) {
e.s = this.s;
var i = Math.floor(t / this.DB);
if (i >= this.t) e.t = 0;else {
var r = t % this.DB,
n = this.DB - r,
s = (1 << r) - 1;
e[0] = this[i] >> r;
for (var o = i + 1; o < this.t; ++o) {
e[o - i - 1] |= (this[o] & s) << n, e[o - i] = this[o] >> r;
}
r > 0 && (e[this.t - i - 1] |= (this.s & s) << n), e.t = this.t - i, e.clamp();
}
}, t.prototype.subTo = function (t, e) {
for (var i = 0, r = 0, n = Math.min(t.t, this.t); i < n;) {
r += this[i] - t[i], e[i++] = r & this.DM, r >>= this.DB;
}
if (t.t < this.t) {
for (r -= t.s; i < this.t;) {
r += this[i], e[i++] = r & this.DM, r >>= this.DB;
}
r += this.s;
} else {
for (r += this.s; i < t.t;) {
r -= t[i], e[i++] = r & this.DM, r >>= this.DB;
}
r -= t.s;
}
e.s = r < 0 ? -1 : 0, r < -1 ? e[i++] = this.DV + r : r > 0 && (e[i++] = r), e.t = i, e.clamp();
}, t.prototype.multiplyTo = function (e, i) {
var r = this.abs(),
n = e.abs(),
s = r.t;
for (i.t = s + n.t; --s >= 0;) {
i[s] = 0;
}
for (s = 0; s < n.t; ++s) {
i[s + r.t] = r.am(0, n[s], i, s, 0, r.t);
}
i.s = 0, i.clamp(), this.s != e.s && t.ZERO.subTo(i, i);
}, t.prototype.squareTo = function (t) {
for (var e = this.abs(), i = t.t = 2 * e.t; --i >= 0;) {
t[i] = 0;
}
for (i = 0; i < e.t - 1; ++i) {
var r = e.am(i, e[i], t, 2 * i, 0, 1);
(t[i + e.t] += e.am(i + 1, 2 * e[i], t, 2 * i + 1, r, e.t - i - 1)) >= e.DV && (t[i + e.t] -= e.DV, t[i + e.t + 1] = 1);
}
t.t > 0 && (t[t.t - 1] += e.am(i, e[i], t, 2 * i, 0, 1)), t.s = 0, t.clamp();
}, t.prototype.divRemTo = function (e, i, r) {
var n = e.abs();
if (!(n.t <= 0)) {
var s = this.abs();
if (s.t < n.t) return null != i && i.fromInt(0), void (null != r && this.copyTo(r));
null == r && (r = N());
var o = N(),
h = this.s,
a = e.s,
u = this.DB - F(n[n.t - 1]);
u > 0 ? (n.lShiftTo(u, o), s.lShiftTo(u, r)) : (n.copyTo(o), s.copyTo(r));
var c = o.t,
f = o[c - 1];
if (0 != f) {
var l = f * (1 << this.F1) + (c > 1 ? o[c - 2] >> this.F2 : 0),
p = this.FV / l,
g = (1 << this.F1) / l,
d = 1 << this.F2,
v = r.t,
m = v - c,
y = null == i ? N() : i;
for (o.dlShiftTo(m, y), r.compareTo(y) >= 0 && (r[r.t++] = 1, r.subTo(y, r)), t.ONE.dlShiftTo(c, y), y.subTo(o, o); o.t < c;) {
o[o.t++] = 0;
}
for (; --m >= 0;) {
var b = r[--v] == f ? this.DM : Math.floor(r[v] * p + (r[v - 1] + d) * g);
if ((r[v] += o.am(0, b, r, m, 0, c)) < b) for (o.dlShiftTo(m, y), r.subTo(y, r); r[v] < --b;) {
r.subTo(y, r);
}
}
null != i && (r.drShiftTo(c, i), h != a && t.ZERO.subTo(i, i)), r.t = c, r.clamp(), u > 0 && r.rShiftTo(u, r), h < 0 && t.ZERO.subTo(r, r);
}
}
}, t.prototype.invDigit = function () {
if (this.t < 1) return 0;
var t = this[0];
if (0 == (1 & t)) return 0;
var e = 3 & t;
return (e = (e = (e = (e = e * (2 - (15 & t) * e) & 15) * (2 - (255 & t) * e) & 255) * (2 - ((65535 & t) * e & 65535)) & 65535) * (2 - t * e % this.DV) % this.DV) > 0 ? this.DV - e : -e;
}, t.prototype.isEven = function () {
return 0 == (this.t > 0 ? 1 & this[0] : this.s);
}, t.prototype.exp = function (e, i) {
if (e > 4294967295 || e < 1) return t.ONE;
var r = N(),
n = N(),
s = i.convert(this),
o = F(e) - 1;
for (s.copyTo(r); --o >= 0;) {
if (i.sqrTo(r, n), (e & 1 << o) > 0) i.mulTo(n, s, r);else {
var h = r;
r = n, n = h;
}
}
return i.revert(r);
}, t.prototype.chunkSize = function (t) {
return Math.floor(Math.LN2 * this.DB / Math.log(t));
}, t.prototype.toRadix = function (t) {
if (null == t && (t = 10), 0 == this.signum() || t < 2 || t > 36) return "0";
var e = this.chunkSize(t),
i = Math.pow(t, e),
r = C(i),
n = N(),
s = N(),
o = "";
for (this.divRemTo(r, n, s); n.signum() > 0;) {
o = (i + s.intValue()).toString(t).substr(1) + o, n.divRemTo(r, n, s);
}
return s.intValue().toString(t) + o;
}, t.prototype.fromRadix = function (e, i) {
this.fromInt(0), null == i && (i = 10);
for (var r = this.chunkSize(i), n = Math.pow(i, r), s = !1, o = 0, h = 0, a = 0; a < e.length; ++a) {
var u = H(e, a);
u < 0 ? "-" == e.charAt(a) && 0 == this.signum() && (s = !0) : (h = i * h + u, ++o >= r && (this.dMultiply(n), this.dAddOffset(h, 0), o = 0, h = 0));
}
o > 0 && (this.dMultiply(Math.pow(i, o)), this.dAddOffset(h, 0)), s && t.ZERO.subTo(this, this);
}, t.prototype.fromNumber = function (e, i, r) {
if ("number" == typeof i) {
if (e < 2) this.fromInt(1);else for (this.fromNumber(e, r), this.testBit(e - 1) || this.bitwiseTo(t.ONE.shiftLeft(e - 1), s, this), this.isEven() && this.dAddOffset(1, 0); !this.isProbablePrime(i);) {
this.dAddOffset(2, 0), this.bitLength() > e && this.subTo(t.ONE.shiftLeft(e - 1), this);
}
} else {
var n = [],
o = 7 & e;
n.length = 1 + (e >> 3), i.nextBytes(n), o > 0 ? n[0] &= (1 << o) - 1 : n[0] = 0, this.fromString(n, 256);
}
}, t.prototype.bitwiseTo = function (t, e, i) {
var r,
n,
s = Math.min(t.t, this.t);
for (r = 0; r < s; ++r) {
i[r] = e(this[r], t[r]);
}
if (t.t < this.t) {
for (n = t.s & this.DM, r = s; r < this.t; ++r) {
i[r] = e(this[r], n);
}
i.t = this.t;
} else {
for (n = this.s & this.DM, r = s; r < t.t; ++r) {
i[r] = e(n, t[r]);
}
i.t = t.t;
}
i.s = e(this.s, t.s), i.clamp();
}, t.prototype.changeBit = function (e, i) {
var r = t.ONE.shiftLeft(e);
return this.bitwiseTo(r, i, r), r;
}, t.prototype.addTo = function (t, e) {
for (var i = 0, r = 0, n = Math.min(t.t, this.t); i < n;) {
r += this[i] + t[i], e[i++] = r & this.DM, r >>= this.DB;
}
if (t.t < this.t) {
for (r += t.s; i < this.t;) {
r += this[i], e[i++] = r & this.DM, r >>= this.DB;
}
r += this.s;
} else {
for (r += this.s; i < t.t;) {
r += t[i], e[i++] = r & this.DM, r >>= this.DB;
}
r += t.s;
}
e.s = r < 0 ? -1 : 0, r > 0 ? e[i++] = r : r < -1 && (e[i++] = this.DV + r), e.t = i, e.clamp();
}, t.prototype.dMultiply = function (t) {
this[this.t] = this.am(0, t - 1, this, 0, 0, this.t), ++this.t, this.clamp();
}, t.prototype.dAddOffset = function (t, e) {
if (0 != t) {
for (; this.t <= e;) {
this[this.t++] = 0;
}
for (this[e] += t; this[e] >= this.DV;) {
this[e] -= this.DV, ++e >= this.t && (this[this.t++] = 0), ++this[e];
}
}
}, t.prototype.multiplyLowerTo = function (t, e, i) {
var r = Math.min(this.t + t.t, e);
for (i.s = 0, i.t = r; r > 0;) {
i[--r] = 0;
}
for (var n = i.t - this.t; r < n; ++r) {
i[r + this.t] = this.am(0, t[r], i, r, 0, this.t);
}
for (n = Math.min(t.t, e); r < n; ++r) {
this.am(0, t[r], i, r, 0, e - r);
}
i.clamp();
}, t.prototype.multiplyUpperTo = function (t, e, i) {
--e;
var r = i.t = this.t + t.t - e;
for (i.s = 0; --r >= 0;) {
i[r] = 0;
}
for (r = Math.max(e - this.t, 0); r < t.t; ++r) {
i[this.t + r - e] = this.am(e - r, t[r], i, 0, 0, this.t + r - e);
}
i.clamp(), i.drShiftTo(1, i);
}, t.prototype.modInt = function (t) {
if (t <= 0) return 0;
var e = this.DV % t,
i = this.s < 0 ? t - 1 : 0;
if (this.t > 0) if (0 == e) i = this[0] % t;else for (var r = this.t - 1; r >= 0; --r) {
i = (e * i + this[r]) % t;
}
return i;
}, t.prototype.millerRabin = function (e) {
var i = this.subtract(t.ONE),
r = i.getLowestSetBit();
if (r <= 0) return !1;
var n = i.shiftRight(r);
(e = e + 1 >> 1) > x.length && (e = x.length);
for (var s = N(), o = 0; o < e; ++o) {
s.fromInt(x[Math.floor(Math.random() * x.length)]);
var h = s.modPow(n, this);
if (0 != h.compareTo(t.ONE) && 0 != h.compareTo(i)) {
for (var a = 1; a++ < r && 0 != h.compareTo(i);) {
if (0 == (h = h.modPowInt(2, this)).compareTo(t.ONE)) return !1;
}
if (0 != h.compareTo(i)) return !1;
}
}
return !0;
}, t.prototype.square = function () {
var t = N();
return this.squareTo(t), t;
}, t.prototype.gcda = function (t, e) {
var i = this.s < 0 ? this.negate() : this.clone(),
r = t.s < 0 ? t.negate() : t.clone();
if (i.compareTo(r) < 0) {
var n = i;
i = r, r = n;
}
var s = i.getLowestSetBit(),
o = r.getLowestSetBit();
if (o < 0) e(i);else {
s < o && (o = s), o > 0 && (i.rShiftTo(o, i), r.rShiftTo(o, r));
var h = function h() {
(s = i.getLowestSetBit()) > 0 && i.rShiftTo(s, i), (s = r.getLowestSetBit()) > 0 && r.rShiftTo(s, r), i.compareTo(r) >= 0 ? (i.subTo(r, i), i.rShiftTo(1, i)) : (r.subTo(i, r), r.rShiftTo(1, r)), i.signum() > 0 ? setTimeout(h, 0) : (o > 0 && r.lShiftTo(o, r), setTimeout(function () {
e(r);
}, 0));
};
setTimeout(h, 10);
}
}, t.prototype.fromNumberAsync = function (e, i, r, n) {
if ("number" == typeof i) {
if (e < 2) this.fromInt(1);else {
this.fromNumber(e, r), this.testBit(e - 1) || this.bitwiseTo(t.ONE.shiftLeft(e - 1), s, this), this.isEven() && this.dAddOffset(1, 0);
var o = this,
h = function h() {
o.dAddOffset(2, 0), o.bitLength() > e && o.subTo(t.ONE.shiftLeft(e - 1), o), o.isProbablePrime(i) ? setTimeout(function () {
n();
}, 0) : setTimeout(h, 0);
};
setTimeout(h, 0);
}
} else {
var a = [],
u = 7 & e;
a.length = 1 + (e >> 3), i.nextBytes(a), u > 0 ? a[0] &= (1 << u) - 1 : a[0] = 0, this.fromString(a, 256);
}
}, t;
}(),
O = function () {
function t() {}
return t.prototype.convert = function (t) {
return t;
}, t.prototype.revert = function (t) {
return t;
}, t.prototype.mulTo = function (t, e, i) {
t.multiplyTo(e, i);
}, t.prototype.sqrTo = function (t, e) {
t.squareTo(e);
}, t;
}(),
A = function () {
function t(t) {
this.m = t;
}
return t.prototype.convert = function (t) {
return t.s < 0 || t.compareTo(this.m) >= 0 ? t.mod(this.m) : t;
}, t.prototype.revert = function (t) {
return t;
}, t.prototype.reduce = function (t) {
t.divRemTo(this.m, null, t);
}, t.prototype.mulTo = function (t, e, i) {
t.multiplyTo(e, i), this.reduce(i);
}, t.prototype.sqrTo = function (t, e) {
t.squareTo(e), this.reduce(e);
}, t;
}(),
V = function () {
function t(t) {
this.m = t, this.mp = t.invDigit(), this.mpl = 32767 & this.mp, this.mph = this.mp >> 15, this.um = (1 << t.DB - 15) - 1, this.mt2 = 2 * t.t;
}
return t.prototype.convert = function (t) {
var e = N();
return t.abs().dlShiftTo(this.m.t, e), e.divRemTo(this.m, null, e), t.s < 0 && e.compareTo(B.ZERO) > 0 && this.m.subTo(e, e), e;
}, t.prototype.revert = function (t) {
var e = N();
return t.copyTo(e), this.reduce(e), e;
}, t.prototype.reduce = function (t) {
for (; t.t <= this.mt2;) {
t[t.t++] = 0;
}
for (var e = 0; e < this.m.t; ++e) {
var i = 32767 & t[e],
r = i * this.mpl + ((i * this.mph + (t[e] >> 15) * this.mpl & this.um) << 15) & t.DM;
for (t[i = e + this.m.t] += this.m.am(0, r, t, e, 0, this.m.t); t[i] >= t.DV;) {
t[i] -= t.DV, t[++i]++;
}
}
t.clamp(), t.drShiftTo(this.m.t, t), t.compareTo(this.m) >= 0 && t.subTo(this.m, t);
}, t.prototype.mulTo = function (t, e, i) {
t.multiplyTo(e, i), this.reduce(i);
}, t.prototype.sqrTo = function (t, e) {
t.squareTo(e), this.reduce(e);
}, t;
}(),
I = function () {
function t(t) {
this.m = t, this.r2 = N(), this.q3 = N(), B.ONE.dlShiftTo(2 * t.t, this.r2), this.mu = this.r2.divide(t);
}
return t.prototype.convert = function (t) {
if (t.s < 0 || t.t > 2 * this.m.t) return t.mod(this.m);
if (t.compareTo(this.m) < 0) return t;
var e = N();
return t.copyTo(e), this.reduce(e), e;
}, t.prototype.revert = function (t) {
return t;
}, t.prototype.reduce = function (t) {
for (t.drShiftTo(this.m.t - 1, this.r2), t.t > this.m.t + 1 && (t.t = this.m.t + 1, t.clamp()), this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3), this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2); t.compareTo(this.r2) < 0;) {
t.dAddOffset(1, this.m.t + 1);
}
for (t.subTo(this.r2, t); t.compareTo(this.m) >= 0;) {
t.subTo(this.m, t);
}
}, t.prototype.mulTo = function (t, e, i) {
t.multiplyTo(e, i), this.reduce(i);
}, t.prototype.sqrTo = function (t, e) {
t.squareTo(e), this.reduce(e);
}, t;
}();
function N() {
return new B(null);
}
function P(t, e) {
return new B(t, e);
}
var M = "undefined" != typeof navigator;
M && "Microsoft Internet Explorer" == navigator.appName ? (B.prototype.am = function (t, e, i, r, n, s) {
for (var o = 32767 & e, h = e >> 15; --s >= 0;) {
var a = 32767 & this[t],
u = this[t++] >> 15,
c = h * a + u * o;
n = ((a = o * a + ((32767 & c) << 15) + i[r] + (1073741823 & n)) >>> 30) + (c >>> 15) + h * u + (n >>> 30), i[r++] = 1073741823 & a;
}
return n;
}, S = 30) : M && "Netscape" != navigator.appName ? (B.prototype.am = function (t, e, i, r, n, s) {
for (; --s >= 0;) {
var o = e * this[t++] + i[r] + n;
n = Math.floor(o / 67108864), i[r++] = 67108863 & o;
}
return n;
}, S = 26) : (B.prototype.am = function (t, e, i, r, n, s) {
for (var o = 16383 & e, h = e >> 14; --s >= 0;) {
var a = 16383 & this[t],
u = this[t++] >> 14,
c = h * a + u * o;
n = ((a = o * a + ((16383 & c) << 14) + i[r] + n) >> 28) + (c >> 14) + h * u, i[r++] = 268435455 & a;
}
return n;
}, S = 28), B.prototype.DB = S, B.prototype.DM = (1 << S) - 1, B.prototype.DV = 1 << S, B.prototype.FV = Math.pow(2, 52), B.prototype.F1 = 52 - S, B.prototype.F2 = 2 * S - 52;
var j,
q,
L = [];
for (j = "0".charCodeAt(0), q = 0; q <= 9; ++q) {
L[j++] = q;
}
for (j = "a".charCodeAt(0), q = 10; q < 36; ++q) {
L[j++] = q;
}
for (j = "A".charCodeAt(0), q = 10; q < 36; ++q) {
L[j++] = q;
}
function H(t, e) {
var i = L[t.charCodeAt(e)];
return null == i ? -1 : i;
}
function C(t) {
var e = N();
return e.fromInt(t), e;
}
function F(t) {
var e,
i = 1;
return 0 != (e = t >>> 16) && (t = e, i += 16), 0 != (e = t >> 8) && (t = e, i += 8), 0 != (e = t >> 4) && (t = e, i += 4), 0 != (e = t >> 2) && (t = e, i += 2), 0 != (e = t >> 1) && (t = e, i += 1), i;
}
B.ZERO = C(0), B.ONE = C(1);
var U,
K,
k = function () {
function t() {
this.i = 0, this.j = 0, this.S = [];
}
return t.prototype.init = function (t) {
var e, i, r;
for (e = 0; e < 256; ++e) {
this.S[e] = e;
}
for (i = 0, e = 0; e < 256; ++e) {
i = i + this.S[e] + t[e % t.length] & 255, r = this.S[e], this.S[e] = this.S[i], this.S[i] = r;
}
this.i = 0, this.j = 0;
}, t.prototype.next = function () {
var t;
return this.i = this.i + 1 & 255, this.j = this.j + this.S[this.i] & 255, t = this.S[this.i], this.S[this.i] = this.S[this.j], this.S[this.j] = t, this.S[t + this.S[this.i] & 255];
}, t;
}(),
_ = null;
if (null == _) {
_ = [], K = 0;
var z = void 0;
if (window.crypto && window.crypto.getRandomValues) {
var Z = new Uint32Array(256);
for (window.crypto.getRandomValues(Z), z = 0; z < Z.length; ++z) {
_[K++] = 255 & Z[z];
}
}
var G = 0,
$ = function $(t) {
if ((G = G || 0) >= 256 || K >= 256) window.removeEventListener ? window.removeEventListener("mousemove", $, !1) : window.detachEvent && window.detachEvent("onmousemove", $);else try {
var e = t.x + t.y;
_[K++] = 255 & e, G += 1;
} catch (t) {}
};
window.addEventListener ? window.addEventListener("mousemove", $, !1) : window.attachEvent && window.attachEvent("onmousemove", $);
}
function Y() {
if (null == U) {
for (U = new k(); K < 256;) {
var t = Math.floor(65536 * Math.random());
_[K++] = 255 & t;
}
for (U.init(_), K = 0; K < _.length; ++K) {
_[K] = 0;
}
K = 0;
}
return U.next();
}
var J = function () {
function t() {}
return t.prototype.nextBytes = function (t) {
for (var e = 0; e < t.length; ++e) {
t[e] = Y();
}
}, t;
}(),
X = function () {
function t() {
this.n = null, this.e = 0, this.d = null, this.p = null, this.q = null, this.dmp1 = null, this.dmq1 = null, this.coeff = null;
}
return t.prototype.doPublic = function (t) {
return t.modPowInt(this.e, this.n);
}, t.prototype.doPrivate = function (t) {
if (null == this.p || null == this.q) return t.modPow(this.d, this.n);
for (var e = t.mod(this.p).modPow(this.dmp1, this.p), i = t.mod(this.q).modPow(this.dmq1, this.q); e.compareTo(i) < 0;) {
e = e.add(this.p);
}
return e.subtract(i).multiply(this.coeff).mod(this.p).multiply(this.q).add(i);
}, t.prototype.setPublic = function (t, e) {
null != t && null != e && t.length > 0 && e.length > 0 ? (this.n = P(t, 16), this.e = parseInt(e, 16)) : console.error("Invalid RSA public key");
}, t.prototype.encrypt = function (t) {
var e = this.n.bitLength() + 7 >> 3,
i = function (t, e) {
if (e < t.length + 11) return console.error("Message too long for RSA"), null;
for (var i = [], r = t.length - 1; r >= 0 && e > 0;) {
var n = t.charCodeAt(r--);
n < 128 ? i[--e] = n : n > 127 && n < 2048 ? (i[--e] = 63 & n | 128, i[--e] = n >> 6 | 192) : (i[--e] = 63 & n | 128, i[--e] = n >> 6 & 63 | 128, i[--e] = n >> 12 | 224);
}
i[--e] = 0;
for (var s = new J(), o = []; e > 2;) {
for (o[0] = 0; 0 == o[0];) {
s.nextBytes(o);
}
i[--e] = o[0];
}
return i[--e] = 2, i[--e] = 0, new B(i);
}(t, e);
if (null == i) return null;
var r = this.doPublic(i);
if (null == r) return null;
for (var n = r.toString(16), s = n.length, o = 0; o < 2 * e - s; o++) {
n = "0" + n;
}
return n;
}, t.prototype.setPrivate = function (t, e, i) {
null != t && null != e && t.length > 0 && e.length > 0 ? (this.n = P(t, 16), this.e = parseInt(e, 16), this.d = P(i, 16)) : console.error("Invalid RSA private key");
}, t.prototype.setPrivateEx = function (t, e, i, r, n, s, o, h) {
null != t && null != e && t.length > 0 && e.length > 0 ? (this.n = P(t, 16), this.e = parseInt(e, 16), this.d = P(i, 16), this.p = P(r, 16), this.q = P(n, 16), this.dmp1 = P(s, 16), this.dmq1 = P(o, 16), this.coeff = P(h, 16)) : console.error("Invalid RSA private key");
}, t.prototype.generate = function (t, e) {
var i = new J(),
r = t >> 1;
this.e = parseInt(e, 16);
for (var n = new B(e, 16);;) {
for (; this.p = new B(t - r, 1, i), 0 != this.p.subtract(B.ONE).gcd(n).compareTo(B.ONE) || !this.p.isProbablePrime(10);) {
;
}
for (; this.q = new B(r, 1, i), 0 != this.q.subtract(B.ONE).gcd(n).compareTo(B.ONE) || !this.q.isProbablePrime(10);) {
;
}
if (this.p.compareTo(this.q) <= 0) {
var s = this.p;
this.p = this.q, this.q = s;
}
var o = this.p.subtract(B.ONE),
h = this.q.subtract(B.ONE),
a = o.multiply(h);
if (0 == a.gcd(n).compareTo(B.ONE)) {
this.n = this.p.multiply(this.q), this.d = n.modInverse(a), this.dmp1 = this.d.mod(o), this.dmq1 = this.d.mod(h), this.coeff = this.q.modInverse(this.p);
break;
}
}
}, t.prototype.decrypt = function (t) {
var e = P(t, 16),
i = this.doPrivate(e);
return null == i ? null : function (t, e) {
for (var i = t.toByteArray(), r = 0; r < i.length && 0 == i[r];) {
++r;
}
if (i.length - r != e - 1 || 2 != i[r]) return null;
for (++r; 0 != i[r];) {
if (++r >= i.length) return null;
}
for (var n = ""; ++r < i.length;) {
var s = 255 & i[r];
s < 128 ? n += String.fromCharCode(s) : s > 191 && s < 224 ? (n += String.fromCharCode((31 & s) << 6 | 63 & i[r + 1]), ++r) : (n += String.fromCharCode((15 & s) << 12 | (63 & i[r + 1]) << 6 | 63 & i[r + 2]), r += 2);
}
return n;
}(i, this.n.bitLength() + 7 >> 3);
}, t.prototype.generateAsync = function (t, e, i) {
var r = new J(),
n = t >> 1;
this.e = parseInt(e, 16);
var s = new B(e, 16),
o = this,
h = function h() {
var e = function e() {
if (o.p.compareTo(o.q) <= 0) {
var t = o.p;
o.p = o.q, o.q = t;
}
var e = o.p.subtract(B.ONE),
r = o.q.subtract(B.ONE),
n = e.multiply(r);
0 == n.gcd(s).compareTo(B.ONE) ? (o.n = o.p.multiply(o.q), o.d = s.modInverse(n), o.dmp1 = o.d.mod(e), o.dmq1 = o.d.mod(r), o.coeff = o.q.modInverse(o.p), setTimeout(function () {
i();
}, 0)) : setTimeout(h, 0);
},
a = function a() {
o.q = N(), o.q.fromNumberAsync(n, 1, r, function () {
o.q.subtract(B.ONE).gcda(s, function (t) {
0 == t.compareTo(B.ONE) && o.q.isProbablePrime(10) ? setTimeout(e, 0) : setTimeout(a, 0);
});
});
},
u = function u() {
o.p = N(), o.p.fromNumberAsync(t - n, 1, r, function () {
o.p.subtract(B.ONE).gcda(s, function (t) {
0 == t.compareTo(B.ONE) && o.p.isProbablePrime(10) ? setTimeout(a, 0) : setTimeout(u, 0);
});
});
};
setTimeout(u, 0);
};
setTimeout(h, 0);
}, t.prototype.sign = function (t, e, i) {
var r = function (t, e) {
if (e < t.length + 22) return console.error("Message too long for RSA"), null;
for (var i = e - t.length - 6, r = "", n = 0; n < i; n += 2) {
r += "ff";
}
return P("0001" + r + "00" + t, 16);
}((Q[i] || "") + e(t).toString(), this.n.bitLength() / 4);
if (null == r) return null;
var n = this.doPrivate(r);
if (null == n) return null;
var s = n.toString(16);
return 0 == (1 & s.length) ? s : "0" + s;
}, t.prototype.verify = function (t, e, i) {
var r = P(e, 16),
n = this.doPublic(r);
return null == n ? null : function (t) {
for (var e in Q) {
if (Q.hasOwnProperty(e)) {
var i = Q[e],
r = i.length;
if (t.substr(0, r) == i) return t.substr(r);
}
}
return t;
}(n.toString(16).replace(/^1f+00/, "")) == i(t).toString();
}, t;
}(),
Q = {
md2: "3020300c06082a864886f70d020205000410",
md5: "3020300c06082a864886f70d020505000410",
sha1: "3021300906052b0e03021a05000414",
sha224: "302d300d06096086480165030402040500041c",
sha256: "3031300d060960864801650304020105000420",
sha384: "3041300d060960864801650304020205000430",
sha512: "3051300d060960864801650304020305000440",
ripemd160: "3021300906052b2403020105000414"
},
W = {};
W.lang = {
extend: function extend(t, e, i) {
if (!e || !t) throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.");
var r = function r() {};
if (r.prototype = e.prototype, t.prototype = new r(), t.prototype.constructor = t, t.superclass = e.prototype, e.prototype.constructor == Object.prototype.constructor && (e.prototype.constructor = e), i) {
var n;
for (n in i) {
t.prototype[n] = i[n];
}
var s = function s() {},
o = ["toString", "valueOf"];
try {
/MSIE/.test(navigator.userAgent) && (s = function s(t, e) {
for (n = 0; n < o.length; n += 1) {
var i = o[n],
r = e[i];
"function" == typeof r && r != Object.prototype[i] && (t[i] = r);
}
});
} catch (t) {}
s(t.prototype, i);
}
}
};
var tt = {};
void 0 !== tt.asn1 && tt.asn1 || (tt.asn1 = {}), tt.asn1.ASN1Util = new function () {
this.integerToByteHex = function (t) {
var e = t.toString(16);
return e.length % 2 == 1 && (e = "0" + e), e;
}, this.bigIntToMinTwosComplementsHex = function (t) {
var e = t.toString(16);
if ("-" != e.substr(0, 1)) e.length % 2 == 1 ? e = "0" + e : e.match(/^[0-7]/) || (e = "00" + e);else {
var i = e.substr(1).length;
i % 2 == 1 ? i += 1 : e.match(/^[0-7]/) || (i += 2);
for (var r = "", n = 0; n < i; n++) {
r += "f";
}
e = new B(r, 16).xor(t).add(B.ONE).toString(16).replace(/^-/, "");
}
return e;
}, this.getPEMStringFromHex = function (t, e) {
return hextopem(t, e);
}, this.newObject = function (t) {
var e = tt.asn1,
i = e.DERBoolean,
r = e.DERInteger,
n = e.DERBitString,
s = e.DEROctetString,
o = e.DERNull,
h = e.DERObjectIdentifier,
a = e.DEREnumerated,
u = e.DERUTF8String,
c = e.DERNumericString,
f = e.DERPrintableString,
l = e.DERTeletexString,
p = e.DERIA5String,
g = e.DERUTCTime,
d = e.DERGeneralizedTime,
v = e.DERSequence,
m = e.DERSet,
y = e.DERTaggedObject,
b = e.ASN1Util.newObject,
T = Object.keys(t);
if (1 != T.length) throw "key of param shall be only one.";
var S = T[0];
if (-1 == ":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":" + S + ":")) throw "undefined key: " + S;
if ("bool" == S) return new i(t[S]);
if ("int" == S) return new r(t[S]);
if ("bitstr" == S) return new n(t[S]);
if ("octstr" == S) return new s(t[S]);
if ("null" == S) return new o(t[S]);
if ("oid" == S) return new h(t[S]);
if ("enum" == S) return new a(t[S]);
if ("utf8str" == S) return new u(t[S]);
if ("numstr" == S) return new c(t[S]);
if ("prnstr" == S) return new f(t[S]);
if ("telstr" == S) return new l(t[S]);
if ("ia5str" == S) return new p(t[S]);
if ("utctime" == S) return new g(t[S]);
if ("gentime" == S) return new d(t[S]);
if ("seq" == S) {
for (var E = t[S], w = [], D = 0; D < E.length; D++) {
var x = b(E[D]);
w.push(x);
}
return new v({
array: w
});
}
if ("set" == S) {
for (E = t[S], w = [], D = 0; D < E.length; D++) {
x = b(E[D]), w.push(x);
}
return new m({
array: w
});
}
if ("tag" == S) {
var R = t[S];
if ("[object Array]" === Object.prototype.toString.call(R) && 3 == R.length) {
var B = b(R[2]);
return new y({
tag: R[0],
explicit: R[1],
obj: B
});
}
var O = {};
if (void 0 !== R.explicit && (O.explicit = R.explicit), void 0 !== R.tag && (O.tag = R.tag), void 0 === R.obj) throw "obj shall be specified for 'tag'.";
return O.obj = b(R.obj), new y(O);
}
}, this.jsonToASN1HEX = function (t) {
return this.newObject(t).getEncodedHex();
};
}(), tt.asn1.ASN1Util.oidHexToInt = function (t) {
for (var e = "", i = parseInt(t.substr(0, 2), 16), r = (e = Math.floor(i / 40) + "." + i % 40, ""), n = 2; n < t.length; n += 2) {
var s = ("00000000" + parseInt(t.substr(n, 2), 16).toString(2)).slice(-8);
r += s.substr(1, 7), "0" == s.substr(0, 1) && (e = e + "." + new B(r, 2).toString(10), r = "");
}
return e;
}, tt.asn1.ASN1Util.oidIntToHex = function (t) {
var e = function e(t) {
var e = t.toString(16);
return 1 == e.length && (e = "0" + e), e;
},
i = function i(t) {
var i = "",
r = new B(t, 10).toString(2),
n = 7 - r.length % 7;
7 == n && (n = 0);
for (var s = "", o = 0; o < n; o++) {
s += "0";
}
for (r = s + r, o = 0; o < r.length - 1; o += 7) {
var h = r.substr(o, 7);
o != r.length - 7 && (h = "1" + h), i += e(parseInt(h, 2));
}
return i;
};
if (!t.match(/^[0-9.]+$/)) throw "malformed oid string: " + t;
var r = "",
n = t.split("."),
s = 40 * parseInt(n[0]) + parseInt(n[1]);
r += e(s), n.splice(0, 2);
for (var o = 0; o < n.length; o++) {
r += i(n[o]);
}
return r;
}, tt.asn1.ASN1Object = function () {
this.getLengthHexFromValue = function () {
if (void 0 === this.hV || null == this.hV) throw "this.hV is null or undefined.";
if (this.hV.length % 2 == 1) throw "value hex must be even length: n=" + "".length + ",v=" + this.hV;
var t = this.hV.length / 2,
e = t.toString(16);
if (e.length % 2 == 1 && (e = "0" + e), t < 128) return e;
var i = e.length / 2;
if (i > 15) throw "ASN.1 length too long to represent by 8x: n = " + t.toString(16);
return (128 + i).toString(16) + e;
}, this.getEncodedHex = function () {
return (null == this.hTLV || this.isModified) && (this.hV = this.getFreshValueHex(), this.hL = this.getLengthHexFromValue(), this.hTLV = this.hT + this.hL + this.hV, this.isModified = !1), this.hTLV;
}, this.getValueHex = function () {
return this.getEncodedHex(), this.hV;
}, this.getFreshValueHex = function () {
return "";
};
}, tt.asn1.DERAbstractString = function (t) {
tt.asn1.DERAbstractString.superclass.constructor.call(this), this.getString = function () {
return this.s;
}, this.setString = function (t) {
this.hTLV = null, this.isModified = !0, this.s = t, this.hV = stohex(this.s);
}, this.setStringHex = function (t) {
this.hTLV = null, this.isModified = !0, this.s = null, this.hV = t;
}, this.getFreshValueHex = function () {
return this.hV;
}, void 0 !== t && ("string" == typeof t ? this.setString(t) : void 0 !== t.str ? this.setString(t.str) : void 0 !== t.hex && this.setStringHex(t.hex));
}, W.lang.extend(tt.asn1.DERAbstractString, tt.asn1.ASN1Object), tt.asn1.DERAbstractTime = function (t) {
tt.asn1.DERAbstractTime.superclass.constructor.call(this), this.localDateToUTC = function (t) {
return utc = t.getTime() + 6e4 * t.getTimezoneOffset(), new Date(utc);
}, this.formatDate = function (t, e, i) {
var r = this.zeroPadding,
n = this.localDateToUTC(t),
s = String(n.getFullYear());
"utc" == e && (s = s.substr(2, 2));
var o = s + r(String(n.getMonth() + 1), 2) + r(String(n.getDate()), 2) + r(String(n.getHours()), 2) + r(String(n.getMinutes()), 2) + r(String(n.getSeconds()), 2);
if (!0 === i) {
var h = n.getMilliseconds();
if (0 != h) {
var a = r(String(h), 3);
o = o + "." + (a = a.replace(/[0]+$/, ""));
}
}
return o + "Z";
}, this.zeroPadding = function (t, e) {
return t.length >= e ? t : new Array(e - t.length + 1).join("0") + t;
}, this.getString = function () {
return this.s;
}, this.setString = function (t) {
this.hTLV = null, this.isModified = !0, this.s = t, this.hV = stohex(t);
}, this.setByDateValue = function (t, e, i, r, n, s) {
var o = new Date(Date.UTC(t, e - 1, i, r, n, s, 0));
this.setByDate(o);
}, this.getFreshValueHex = function () {
return this.hV;
};
}, W.lang.extend(tt.asn1.DERAbstractTime, tt.asn1.ASN1Object), tt.asn1.DERAbstractStructured = function (t) {
tt.asn1.DERAbstractString.superclass.constructor.call(this), this.setByASN1ObjectArray = function (t) {
this.hTLV = null, this.isModified = !0, this.asn1Array = t;
}, this.appendASN1Object = function (t) {
this.hTLV = null, this.isModified = !0, this.asn1Array.push(t);
}, this.asn1Array = new Array(), void 0 !== t && void 0 !== t.array && (this.asn1Array = t.array);
}, W.lang.extend(tt.asn1.DERAbstractStructured, tt.asn1.ASN1Object), tt.asn1.DERBoolean = function () {
tt.asn1.DERBoolean.superclass.constructor.call(this), this.hT = "01", this.hTLV = "0101ff";
}, W.lang.extend(tt.asn1.DERBoolean, tt.asn1.ASN1Object), tt.asn1.DERInteger = function (t) {
tt.asn1.DERInteger.superclass.constructor.call(this), this.hT = "02", this.setByBigInteger = function (t) {
this.hTLV = null, this.isModified = !0, this.hV = tt.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t);
}, this.setByInteger = function (t) {
var e = new B(String(t), 10);
this.setByBigInteger(e);
}, this.setValueHex = function (t) {
this.hV = t;
}, this.getFreshValueHex = function () {
return this.hV;
}, void 0 !== t && (void 0 !== t.bigint ? this.setByBigInteger(t.bigint) : void 0 !== t["int"] ? this.setByInteger(t["int"]) : "number" == typeof t ? this.setByInteger(t) : void 0 !== t.hex && this.setValueHex(t.hex));
}, W.lang.extend(tt.asn1.DERInteger, tt.asn1.ASN1Object), tt.asn1.DERBitString = function (t) {
if (void 0 !== t && void 0 !== t.obj) {
var e = tt.asn1.ASN1Util.newObject(t.obj);
t.hex = "00" + e.getEncodedHex();
}
tt.asn1.DERBitString.superclass.constructor.call(this), this.hT = "03", this.setHexValueIncludingUnusedBits = function (t) {
this.hTLV = null, this.isModified = !0, this.hV = t;
}, this.setUnusedBitsAndHexValue = function (t, e) {
if (t < 0 || 7 < t) throw "unused bits shall be from 0 to 7: u = " + t;
var i = "0" + t;
this.hTLV = null, this.isModified = !0, this.hV = i + e;
}, this.setByBinaryString = function (t) {
var e = 8 - (t = t.replace(/0+$/, "")).length % 8;
8 == e && (e = 0);
for (var i = 0; i <= e; i++) {
t += "0";
}
var r = "";
for (i = 0; i < t.length - 1; i += 8) {
var n = t.substr(i, 8),
s = parseInt(n, 2).toString(16);
1 == s.length && (s = "0" + s), r += s;
}
this.hTLV = null, this.isModified = !0, this.hV = "0" + e + r;
}, this.setByBooleanArray = function (t) {
for (var e = "", i = 0; i < t.length; i++) {
1 == t[i] ? e += "1" : e += "0";
}
this.setByBinaryString(e);
}, this.newFalseArray = function (t) {
for (var e = new Array(t), i = 0; i < t; i++) {
e[i] = !1;
}
return e;
}, this.getFreshValueHex = function () {
return this.hV;
}, void 0 !== t && ("string" == typeof t && t.toLowerCase().match(/^[0-9a-f]+$/) ? this.setHexValueIncludingUnusedBits(t) : void 0 !== t.hex ? this.setHexValueIncludingUnusedBits(t.hex) : void 0 !== t.bin ? this.setByBinaryString(t.bin) : void 0 !== t.array && this.setByBooleanArray(t.array));
}, W.lang.extend(tt.asn1.DERBitString, tt.asn1.ASN1Object), tt.asn1.DEROctetString = function (t) {
if (void 0 !== t && void 0 !== t.obj) {
var e = tt.asn1.ASN1Util.newObject(t.obj);
t.hex = e.getEncodedHex();
}
tt.asn1.DEROctetString.superclass.constructor.call(this, t), this.hT = "04";
}, W.lang.extend(tt.asn1.DEROctetString, tt.asn1.DERAbstractString), tt.asn1.DERNull = function () {
tt.asn1.DERNull.superclass.constructor.call(this), this.hT = "05", this.hTLV = "0500";
}, W.lang.extend(tt.asn1.DERNull, tt.asn1.ASN1Object), tt.asn1.DERObjectIdentifier = function (t) {
var e = function e(t) {
var e = t.toString(16);
return 1 == e.length && (e = "0" + e), e;
},
i = function i(t) {
var i = "",
r = new B(t, 10).toString(2),
n = 7 - r.length % 7;
7 == n && (n = 0);
for (var s = "", o = 0; o < n; o++) {
s += "0";
}
for (r = s + r, o = 0; o < r.length - 1; o += 7) {
var h = r.substr(o, 7);
o != r.length - 7 && (h = "1" + h), i += e(parseInt(h, 2));
}
return i;
};
tt.asn1.DERObjectIdentifier.superclass.constructor.call(this), this.hT = "06", this.setValueHex = function (t) {
this.hTLV = null, this.isModified = !0, this.s = null, this.hV = t;
}, this.setValueOidString = function (t) {
if (!t.match(/^[0-9.]+$/)) throw "malformed oid string: " + t;
var r = "",
n = t.split("."),
s = 40 * parseInt(n[0]) + parseInt(n[1]);
r += e(s), n.splice(0, 2);
for (var o = 0; o < n.length; o++) {
r += i(n[o]);
}
this.hTLV = null, this.isModified = !0, this.s = null, this.hV = r;
}, this.setValueName = function (t) {
var e = tt.asn1.x509.OID.name2oid(t);
if ("" === e) throw "DERObjectIdentifier oidName undefined: " + t;
this.setValueOidString(e);
}, this.getFreshValueHex = function () {
return this.hV;
}, void 0 !== t && ("string" == typeof t ? t.match(/^[0-2].[0-9.]+$/) ? this.setValueOidString(t) : this.setValueName(t) : void 0 !== t.oid ? this.setValueOidString(t.oid) : void 0 !== t.hex ? this.setValueHex(t.hex) : void 0 !== t.name && this.setValueName(t.name));
}, W.lang.extend(tt.asn1.DERObjectIdentifier, tt.asn1.ASN1Object), tt.asn1.DEREnumerated = function (t) {
tt.asn1.DEREnumerated.superclass.constructor.call(this), this.hT = "0a", this.setByBigInteger = function (t) {
this.hTLV = null, this.isModified = !0, this.hV = tt.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t);
}, this.setByInteger = function (t) {
var e = new B(String(t), 10);
this.setByBigInteger(e);
}, this.setValueHex = function (t) {
this.hV = t;
}, this.getFreshValueHex = function () {
return this.hV;
}, void 0 !== t && (void 0 !== t["int"] ? this.setByInteger(t["int"]) : "number" == typeof t ? this.setByInteger(t) : void 0 !== t.hex && this.setValueHex(t.hex));
}, W.lang.extend(tt.asn1.DEREnumerated, tt.asn1.ASN1Object), tt.asn1.DERUTF8String = function (t) {
tt.asn1.DERUTF8String.superclass.constructor.call(this, t), this.hT = "0c";
}, W.lang.extend(tt.asn1.DERUTF8String, tt.asn1.DERAbstractString), tt.asn1.DERNumericString = function (t) {
tt.asn1.DERNumericString.superclass.constructor.call(this, t), this.hT = "12";
}, W.lang.extend(tt.asn1.DERNumericString, tt.asn1.DERAbstractString), tt.asn1.DERPrintableString = function (t) {
tt.asn1.DERPrintableString.superclass.constructor.call(this, t), this.hT = "13";
}, W.lang.extend(tt.asn1.DERPrintableString, tt.asn1.DERAbstractString), tt.asn1.DERTeletexString = function (t) {
tt.asn1.DERTeletexString.superclass.constructor.call(this, t), this.hT = "14";
}, W.lang.extend(tt.asn1.DERTeletexString, tt.asn1.DERAbstractString), tt.asn1.DERIA5String = function (t) {
tt.asn1.DERIA5String.superclass.constructor.call(this, t), this.hT = "16";
}, W.lang.extend(tt.asn1.DERIA5String, tt.asn1.DERAbstractString), tt.asn1.DERUTCTime = function (t) {
tt.asn1.DERUTCTime.superclass.constructor.call(this, t), this.hT = "17", this.setByDate = function (t) {
this.hTLV = null, this.isModified = !0, this.date = t, this.s = this.formatDate(this.date, "utc"), this.hV = stohex(this.s);
}, this.getFreshValueHex = function () {
return void 0 === this.date && void 0 === this.s && (this.date = new Date(), this.s = this.formatDate(this.date, "utc"), this.hV = stohex(this.s)), this.hV;
}, void 0 !== t && (void 0 !== t.str ? this.setString(t.str) : "string" == typeof t && t.match(/^[0-9]{12}Z$/) ? this.setString(t) : void 0 !== t.hex ? this.setStringHex(t.hex) : void 0 !== t.date && this.setByDate(t.date));
}, W.lang.extend(tt.asn1.DERUTCTime, tt.asn1.DERAbstractTime), tt.asn1.DERGeneralizedTime = function (t) {
tt.asn1.DERGeneralizedTime.superclass.constructor.call(this, t), this.hT = "18", this.withMillis = !1, this.setByDate = function (t) {
this.hTLV = null, this.isModified = !0, this.date = t, this.s = this.formatDate(this.date, "gen", this.withMillis), this.hV = stohex(this.s);
}, this.getFreshValueHex = function () {
return void 0 === this.date && void 0 === this.s && (this.date = new Date(), this.s = this.formatDate(this.date, "gen", this.withMillis), this.hV = stohex(this.s)), this.hV;
}, void 0 !== t && (void 0 !== t.str ? this.setString(t.str) : "string" == typeof t && t.match(/^[0-9]{14}Z$/) ? this.setString(t) : void 0 !== t.hex ? this.setStringHex(t.hex) : void 0 !== t.date && this.setByDate(t.date), !0 === t.millis && (this.withMillis = !0));
}, W.lang.extend(tt.asn1.DERGeneralizedTime, tt.asn1.DERAbstractTime), tt.asn1.DERSequence = function (t) {
tt.asn1.DERSequence.superclass.constructor.call(this, t), this.hT = "30", this.getFreshValueHex = function () {
for (var t = "", e = 0; e < this.asn1Array.length; e++) {
t += this.asn1Array[e].getEncodedHex();
}
return this.hV = t, this.hV;
};
}, W.lang.extend(tt.asn1.DERSequence, tt.asn1.DERAbstractStructured), tt.asn1.DERSet = function (t) {
tt.asn1.DERSet.superclass.constructor.call(this, t), this.hT = "31", this.sortFlag = !0, this.getFreshValueHex = function () {
for (var t = new Array(), e = 0; e < this.asn1Array.length; e++) {
var i = this.asn1Array[e];
t.push(i.getEncodedHex());
}
return 1 == this.sortFlag && t.sort(), this.hV = t.join(""), this.hV;
}, void 0 !== t && void 0 !== t.sortflag && 0 == t.sortflag && (this.sortFlag = !1);
}, W.lang.extend(tt.asn1.DERSet, tt.asn1.DERAbstractStructured), tt.asn1.DERTaggedObject = function (t) {
tt.asn1.DERTaggedObject.superclass.constructor.call(this), this.hT = "a0", this.hV = "", this.isExplicit = !0, this.asn1Object = null, this.setASN1Object = function (t, e, i) {
this.hT = e, this.isExplicit = t, this.asn1Object = i, this.isExplicit ? (this.hV = this.asn1Object.getEncodedHex(), this.hTLV = null, this.isModified = !0) : (this.hV = null, this.hTLV = i.getEncodedHex(), this.hTLV = this.hTLV.replace(/^../, e), this.isModified = !1);
}, this.getFreshValueHex = function () {
return this.hV;
}, void 0 !== t && (void 0 !== t.tag && (this.hT = t.tag), void 0 !== t.explicit && (this.isExplicit = t.explicit), void 0 !== t.obj && (this.asn1Object = t.obj, this.setASN1Object(this.isExplicit, this.hT, this.asn1Object)));
}, W.lang.extend(tt.asn1.DERTaggedObject, tt.asn1.ASN1Object);
var _et,
it = (_et = function et(t, e) {
return (_et = Object.setPrototypeOf || {
__proto__: []
} instanceof Array && function (t, e) {
t.__proto__ = e;
} || function (t, e) {
for (var i in e) {
Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
}
})(t, e);
}, function (t, e) {
if ("function" != typeof e && null !== e) throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
function i() {
this.constructor = t;
}
_et(t, e), t.prototype = null === e ? Object.create(e) : (i.prototype = e.prototype, new i());
}),
rt = function (t) {
function e(i) {
var r = t.call(this) || this;
return i && ("string" == typeof i ? r.parseKey(i) : (e.hasPrivateKeyProperty(i) || e.hasPublicKeyProperty(i)) && r.parsePropertiesFrom(i)), r;
}
return it(e, t), e.prototype.parseKey = function (t) {
try {
var e = 0,
i = 0,
r = /^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(t) ? function (t) {
var e;
if (void 0 === c) {
var i = "0123456789ABCDEF",
r = " \f\n\r\t \u2028\u2029";
for (c = {}, e = 0; e < 16; ++e) {
c[i.charAt(e)] = e;
}
for (i = i.toLowerCase(), e = 10; e < 16; ++e) {
c[i.charAt(e)] = e;
}
for (e = 0; e < r.length; ++e) {
c[r.charAt(e)] = -1;
}
}
var n = [],
s = 0,
o = 0;
for (e = 0; e < t.length; ++e) {
var h = t.charAt(e);
if ("=" == h) break;
if (-1 != (h = c[h])) {
if (void 0 === h) throw new Error("Illegal character at offset " + e);
s |= h, ++o >= 2 ? (n[n.length] = s, s = 0, o = 0) : s <<= 4;
}
}
if (o) throw new Error("Hex encoding incomplete: 4 bits missing");
return n;
}(t) : d.unarmor(t),
n = w.decode(r);
if (3 === n.sub.length && (n = n.sub[2].sub[0]), 9 === n.sub.length) {
e = n.sub[1].getHexStringValue(), this.n = P(e, 16), i = n.sub[2].getHexStringValue(), this.e = parseInt(i, 16);
var s = n.sub[3].getHexStringValue();
this.d = P(s, 16);
var o = n.sub[4].getHexStringValue();
this.p = P(o, 16);
var h = n.sub[5].getHexStringValue();
this.q = P(h, 16);
var a = n.sub[6].getHexStringValue();
this.dmp1 = P(a, 16);
var u = n.sub[7].getHexStringValue();
this.dmq1 = P(u, 16);
var f = n.sub[8].getHexStringValue();
this.coeff = P(f, 16);
} else {
if (2 !== n.sub.length) return !1;
var l = n.sub[1].sub[0];
e = l.sub[0].getHexStringValue(), this.n = P(e, 16), i = l.sub[1].getHexStringValue(), this.e = parseInt(i, 16);
}
return !0;
} catch (t) {
return !1;
}
}, e.prototype.getPrivateBaseKey = function () {
var t = {
array: [new tt.asn1.DERInteger({
"int": 0
}), new tt.asn1.DERInteger({
bigint: this.n
}), new tt.asn1.DERInteger({
"int": this.e
}), new tt.asn1.DERInteger({
bigint: this.d
}), new tt.asn1.DERInteger({
bigint: this.p
}), new tt.asn1.DERInteger({
bigint: this.q
}), new tt.asn1.DERInteger({
bigint: this.dmp1
}), new tt.asn1.DERInteger({
bigint: this.dmq1
}), new tt.asn1.DERInteger({
bigint: this.coeff
})]
};
return new tt.asn1.DERSequence(t).getEncodedHex();
}, e.prototype.getPrivateBaseKeyB64 = function () {
return l(this.getPrivateBaseKey());
}, e.prototype.getPublicBaseKey = function () {
var t = new tt.asn1.DERSequence({
array: [new tt.asn1.DERObjectIdentifier({
oid: "1.2.840.113549.1.1.1"
}), new tt.asn1.DERNull()]
}),
e = new tt.asn1.DERSequence({
array: [new tt.asn1.DERInteger({
bigint: this.n
}), new tt.asn1.DERInteger({
"int": this.e
})]
}),
i = new tt.asn1.DERBitString({
hex: "00" + e.getEncodedHex()
});
return new tt.asn1.DERSequence({
array: [t, i]
}).getEncodedHex();
}, e.prototype.getPublicBaseKeyB64 = function () {
return l(this.getPublicBaseKey());
}, e.wordwrap = function (t, e) {
if (!t) return t;
var i = "(.{1," + (e = e || 64) + "})( +|$\n?)|(.{1," + e + "})";
return t.match(RegExp(i, "g")).join("\n");
}, e.prototype.getPrivateKey = function () {
var t = "-----BEGIN RSA PRIVATE KEY-----\n";
return (t += e.wordwrap(this.getPrivateBaseKeyB64()) + "\n") + "-----END RSA PRIVATE KEY-----";
}, e.prototype.getPublicKey = function () {
var t = "-----BEGIN PUBLIC KEY-----\n";
return (t += e.wordwrap(this.getPublicBaseKeyB64()) + "\n") + "-----END PUBLIC KEY-----";
}, e.hasPublicKeyProperty = function (t) {
return (t = t || {}).hasOwnProperty("n") && t.hasOwnProperty("e");
}, e.hasPrivateKeyProperty = function (t) {
return (t = t || {}).hasOwnProperty("n") && t.hasOwnProperty("e") && t.hasOwnProperty("d") && t.hasOwnProperty("p") && t.hasOwnProperty("q") && t.hasOwnProperty("dmp1") && t.hasOwnProperty("dmq1") && t.hasOwnProperty("coeff");
}, e.prototype.parsePropertiesFrom = function (t) {
this.n = t.n, this.e = t.e, t.hasOwnProperty("d") && (this.d = t.d, this.p = t.p, this.q = t.q, this.dmp1 = t.dmp1, this.dmq1 = t.dmq1, this.coeff = t.coeff);
}, e;
}(X);
var nt = function () {
function t(t) {
t = t || {}, this.default_key_size = t.default_key_size ? parseInt(t.default_key_size, 10) : 1024, this.default_public_exponent = t.default_public_exponent || "010001", this.log = t.log || !1, this.key = null;
}
return t.prototype.setKey = function (t) {
this.log && this.key && console.warn("A key was already set, overriding existing."), this.key = new rt(t);
}, t.prototype.setPrivateKey = function (t) {
this.setKey(t);
}, t.prototype.setPublicKey = function (t) {
this.setKey(t);
}, t.prototype.decrypt = function (t) {
try {
return this.getKey().decrypt(p(t));
} catch (t) {
return !1;
}
}, t.prototype.encrypt = function (t) {
try {
return l(this.getKey().encrypt(t));
} catch (t) {
return !1;
}
}, t.prototype.sign = function (t, e, i) {
try {
return l(this.getKey().sign(t, e, i));
} catch (t) {
return !1;
}
}, t.prototype.verify = function (t, e, i) {
try {
return this.getKey().verify(t, p(e), i);
} catch (t) {
return !1;
}
}, t.prototype.getKey = function (t) {
if (!this.key) {
if (this.key = new rt(), t && "[object Function]" === {}.toString.call(t)) return void this.key.generateAsync(this.default_key_size, this.default_public_exponent, t);
this.key.generate(this.default_key_size, this.default_public_exponent);
}
return this.key;
}, t.prototype.getPrivateKey = function () {
return this.getKey().getPrivateKey();
}, t.prototype.getPrivateKeyB64 = function () {
return this.getKey().getPrivateBaseKeyB64();
}, t.prototype.getPublicKey = function () {
return this.getKey().getPublicKey();
}, t.prototype.getPublicKeyB64 = function () {
return this.getKey().getPublicBaseKeyB64();
}, t.version = "3.1.0", t;
}();
}],
e = {
d: function d(t, i) {
for (var r in i) {
e.o(i, r) && !e.o(t, r) && Object.defineProperty(t, r, {
enumerable: !0,
get: i[r]
});
}
},
o: function o(t, e) {
return Object.prototype.hasOwnProperty.call(t, e);
}
},
i = {};
return t[1](0, i, e), i["default"];
}();
});
var test = function(password) {
var e = ["password"]
var n = new JSEncrypt;
n.setPublicKey("-----BEGIN PUBLIC KEY-----\n MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDl/aCgRl9f/4ON9MewoVnV58OL\n OU2ALBi2FKc5yIsfSpivKxe7A6FitJjHva3WpM7gvVOinMehp6if2UNIkbaN+plW\n f5IwqEVxsNZpeixc4GsbY9dXEk3WtRjwGSyDLySzEESH/kpJVoxO7ijRYqU+2oSR\n wTBNePOk1H+LRQokgQIDAQAB\n -----END PUBLIC KEY-----");
for (var s = 0; s < e.length; s++) {
var t = n.encrypt(password);
return t
}
}
|
import { currencyBaseUrl } from "../BaseUrl"
import { GET } from "../../libapi/rest/request/methods/Get";
import GETRequest from "../../libapi/rest/request/GETRequest";
import UrlBuilder from "../../libapi/rest/request/UrlBuilder";
class GetCurrencies extends GETRequest {
getUrl(props) {
let urlBuilder = new UrlBuilder(currencyBaseUrl)
.addPath("v1")
.addPath("ticker")
urlBuilder.addQueryParam("convert", "INR");
urlBuilder.addQueryParam("start", props.start);
urlBuilder.addQueryParam("limit", props.limit);
return urlBuilder.build();
}
}
// handle network issue and api fail issue
export default GetCurrencies;
|
'use strict';
const _ = require('lodash');
const awsArnRegExs = require('../../../../../utils/arnRegularExpressions');
const NOT_FOUND = -1;
const DEFAULT_STATUS_CODES = {
200: {
pattern: '',
},
400: {
pattern: '[\\s\\S]*\\[400\\][\\s\\S]*',
},
401: {
pattern: '[\\s\\S]*\\[401\\][\\s\\S]*',
},
403: {
pattern: '[\\s\\S]*\\[403\\][\\s\\S]*',
},
404: {
pattern: '[\\s\\S]*\\[404\\][\\s\\S]*',
},
422: {
pattern: '[\\s\\S]*\\[422\\][\\s\\S]*',
},
500: {
pattern: '[\\s\\S]*(Process\\s?exited\\s?before\\s?completing\\s?request|\\[500\\])[\\s\\S]*',
},
502: {
pattern: '[\\s\\S]*\\[502\\][\\s\\S]*',
},
504: {
pattern: '([\\s\\S]*\\[504\\][\\s\\S]*)|(^[Task timed out].*)',
},
};
module.exports = {
validate() {
const events = [];
const corsPreflight = {};
_.forEach(this.serverless.service.functions, (functionObject, functionName) => {
_.forEach(functionObject.events, (event) => {
if (_.has(event, 'http')) {
const http = this.getHttp(event, functionName);
http.path = this.getHttpPath(http, functionName);
http.method = this.getHttpMethod(http, functionName);
if (http.authorizer) {
http.authorizer = this.getAuthorizer(http, functionName);
}
if (http.cors) {
http.cors = this.getCors(http);
const cors = corsPreflight[http.path] || {};
cors.headers = _.union(http.cors.headers, cors.headers);
cors.methods = _.union(http.cors.methods, cors.methods);
cors.origins = _.union(http.cors.origins, cors.origins);
cors.origin = http.cors.origin || '*';
cors.allowCredentials = cors.allowCredentials || http.cors.allowCredentials;
// when merging, last one defined wins
if (_.has(http.cors, 'maxAge')) {
cors.maxAge = http.cors.maxAge;
}
corsPreflight[http.path] = cors;
}
http.integration = this.getIntegration(http, functionName);
if ((http.integration === 'HTTP' || http.integration === 'HTTP_PROXY') &&
(!http.request || !http.request.uri)) {
const errorMessage = [
`You need to set the request uri when using the ${http.integration} integration.`,
];
throw new this.serverless.classes.Error(errorMessage);
}
if (http.integration === 'AWS' || http.integration === 'HTTP') {
http.request = this.getRequest(http);
http.request.passThrough = this.getRequestPassThrough(http);
http.response = this.getResponse(http);
if (http.integration === 'AWS' && _.isEmpty(http.response)) {
http.response = {
statusCodes: DEFAULT_STATUS_CODES,
};
}
} else if (http.integration === 'AWS_PROXY' || http.integration === 'HTTP_PROXY') {
// show a warning when request / response config is used with AWS_PROXY (LAMBDA-PROXY)
if (http.request) {
const keys = Object.keys(http.request);
const allowedKeys =
http.integration === 'AWS_PROXY' ? ['parameters'] : ['parameters', 'uri'];
if (!_.isEmpty(_.difference(keys, allowedKeys))) {
const requestWarningMessage = [
`Warning! You're using the ${http.integration} in combination with a request`,
` configuration in your function "${functionName}". Only the `,
_.map(allowedKeys, value => `request.${value}`).join(', '),
` configs are available in conjunction with ${http.integration}.`,
' Serverless will remove this configuration automatically',
' before deployment.',
].join('');
this.serverless.cli.log(requestWarningMessage);
for (const key of keys) {
if (!_.includes(allowedKeys, key)) {
delete http.request[key];
}
}
}
if (Object.keys(http.request).length === 0) {
// No keys left, delete the request object
delete http.request;
} else {
http.request = this.getRequest(http);
}
}
if (http.response) {
const warningMessage = [
`Warning! You're using the ${http.integration} in combination with response`,
` configuration in your function "${functionName}".`,
' Serverless will remove this configuration automatically before deployment.',
].join('');
this.serverless.cli.log(warningMessage);
delete http.response;
}
}
events.push({
functionName,
http,
});
}
});
});
return {
events,
corsPreflight,
};
},
getHttp(event, functionName) {
if (typeof event.http === 'object') {
return event.http;
} else if (typeof event.http === 'string') {
return {
method: event.http.split(' ')[0],
path: event.http.split(' ')[1],
};
}
const errorMessage = [
`Invalid http event in function "${functionName}"`,
' in serverless.yml.',
' If you define an http event, make sure you pass a valid value for it,',
' either as string syntax, or object syntax.',
' Please check the docs for more options.',
].join('');
throw new this.serverless.classes.Error(errorMessage);
},
getHttpPath(http, functionName) {
if (http && typeof http.path === 'string') {
return http.path.replace(/^\//, '').replace(/\/$/, '');
}
const errorMessage = [
`Missing or invalid "path" property in function "${functionName}"`,
' for http event in serverless.yml.',
' If you define an http event, make sure you pass a valid value for it,',
' either as string syntax, or object syntax.',
' Please check the indentation of your config values if you use the object syntax.',
' Please check the docs for more options.',
].join('');
throw new this.serverless.classes.Error(errorMessage);
},
getHttpMethod(http, functionName) {
if (typeof http.method === 'string') {
const method = http.method.toLowerCase();
const allowedMethods = [
'get', 'post', 'put', 'patch', 'options', 'head', 'delete', 'any',
];
if (allowedMethods.indexOf(method) === -1) {
const errorMessage = [
`Invalid APIG method "${http.method}" in function "${functionName}".`,
` AWS supported methods are: ${allowedMethods.join(', ')}.`,
].join('');
throw new this.serverless.classes.Error(errorMessage);
}
return method;
}
const errorMessage = [
`Missing or invalid "method" property in function "${functionName}"`,
' for http event in serverless.yml.',
' If you define an http event, make sure you pass a valid value for it,',
' either as string syntax, or object syntax.',
' Please check the docs for more options.',
].join('');
throw new this.serverless.classes.Error(errorMessage);
},
getAuthorizer(http, functionName) {
const authorizer = http.authorizer;
let type;
let name;
let arn;
let identitySource;
let resultTtlInSeconds;
let identityValidationExpression;
let claims;
let authorizerId;
if (typeof authorizer === 'string') {
if (authorizer.toUpperCase() === 'AWS_IAM') {
type = 'AWS_IAM';
} else if (authorizer.indexOf(':') === -1) {
name = authorizer;
arn = this.getLambdaArn(authorizer);
} else {
arn = authorizer;
name = this.provider.naming.extractAuthorizerNameFromArn(arn);
}
} else if (typeof authorizer === 'object') {
if (authorizer.type && authorizer.authorizerId) {
type = authorizer.type;
authorizerId = authorizer.authorizerId;
} else if (authorizer.type && authorizer.type.toUpperCase() === 'AWS_IAM') {
type = 'AWS_IAM';
} else if (authorizer.arn) {
arn = authorizer.arn;
if (_.isString(authorizer.name)) {
name = authorizer.name;
} else {
name = this.provider.naming.extractAuthorizerNameFromArn(arn);
}
} else if (authorizer.name) {
name = authorizer.name;
arn = this.getLambdaArn(name);
} else {
throw new this.serverless.classes.Error('Please provide either an authorizer name or ARN');
}
if (!type) {
type = authorizer.type;
}
resultTtlInSeconds = Number.parseInt(authorizer.resultTtlInSeconds, 10);
resultTtlInSeconds = Number.isNaN(resultTtlInSeconds) ? 300 : resultTtlInSeconds;
claims = authorizer.claims || [];
identitySource = authorizer.identitySource;
identityValidationExpression = authorizer.identityValidationExpression;
} else {
const errorMessage = [
`authorizer property in function ${functionName} is not an object nor a string.`,
' The correct format is: authorizer: functionName',
' OR an object containing a name property.',
' Please check the docs for more info.',
].join('');
throw new this.serverless.classes.Error(errorMessage);
}
if (typeof identitySource === 'undefined') {
identitySource = 'method.request.header.Authorization';
}
const integration = this.getIntegration(http);
if (integration === 'AWS_PROXY'
&& typeof arn === 'string'
&& awsArnRegExs.cognitoIdpArnExpr.test(arn)
&& authorizer.claims) {
const errorMessage = [
'Cognito claims can only be filtered when using the lambda integration type',
];
throw new this.serverless.classes.Error(errorMessage);
}
return {
type,
name,
arn,
authorizerId,
resultTtlInSeconds,
identitySource,
identityValidationExpression,
claims,
};
},
getCors(http) {
const headers = [
'Content-Type',
'X-Amz-Date',
'Authorization',
'X-Api-Key',
'X-Amz-Security-Token',
'X-Amz-User-Agent',
];
let cors = {
origins: ['*'],
origin: '*',
methods: ['OPTIONS'],
headers,
allowCredentials: false,
};
if (typeof http.cors === 'object') {
cors = http.cors;
cors.methods = cors.methods || [];
cors.allowCredentials = Boolean(cors.allowCredentials);
if (cors.origins && cors.origin) {
const errorMessage = [
'You can only use "origin" or "origins",',
' but not both at the same time to configure CORS.',
' Please check the docs for more info.',
].join('');
throw new this.serverless.classes.Error(errorMessage);
}
if (cors.headers) {
if (!Array.isArray(cors.headers)) {
const errorMessage = [
'CORS header values must be provided as an array.',
' Please check the docs for more info.',
].join('');
throw new this.serverless.classes.Error(errorMessage);
}
} else {
cors.headers = headers;
}
if (cors.methods.indexOf('OPTIONS') === NOT_FOUND) {
cors.methods.push('OPTIONS');
}
if (cors.methods.indexOf(http.method.toUpperCase()) === NOT_FOUND) {
cors.methods.push(http.method.toUpperCase());
}
if (_.has(cors, 'maxAge')) {
if (!_.isInteger(cors.maxAge) || cors.maxAge < 1) {
const errorMessage = 'maxAge should be an integer over 0';
throw new this.serverless.classes.Error(errorMessage);
}
}
} else {
cors.methods.push(http.method.toUpperCase());
}
return cors;
},
getIntegration(http, functionName) {
if (http.integration) {
// normalize the integration for further processing
const normalizedIntegration = http.integration.toUpperCase().replace('-', '_');
const allowedIntegrations = [
'LAMBDA_PROXY', 'LAMBDA', 'AWS', 'AWS_PROXY', 'HTTP', 'HTTP_PROXY', 'MOCK',
];
// check if the user has entered a non-valid integration
if (allowedIntegrations.indexOf(normalizedIntegration) === NOT_FOUND) {
const errorMessage = [
`Invalid APIG integration "${http.integration}"`,
` in function "${functionName}".`,
' Supported integrations are:',
' lambda, lambda-proxy, aws, aws-proxy, http, http-proxy, mock.',
].join('');
throw new this.serverless.classes.Error(errorMessage);
}
if (normalizedIntegration === 'LAMBDA') {
return 'AWS';
} else if (normalizedIntegration === 'LAMBDA_PROXY') {
return 'AWS_PROXY';
}
return normalizedIntegration;
}
return 'AWS_PROXY';
},
getRequest(http) {
if (http.request) {
const request = http.request;
if (typeof http.request !== 'object') {
const errorMessage = [
'Request config must be provided as an object.',
' Please check the docs for more info.',
].join('');
throw new this.serverless.classes.Error(errorMessage);
}
if (http.request.template && typeof http.request.template !== 'object') {
const errorMessage = [
'Template config must be provided as an object.',
' Please check the docs for more info.',
].join('');
throw new this.serverless.classes.Error(errorMessage);
}
if (request.parameters) {
request.parameters = this.getRequestParameters(request);
}
return request;
}
return {};
},
getRequestParameters(httpRequest) {
const parameters = {};
// only these locations are currently supported
const locations = ['querystrings', 'paths', 'headers'];
_.each(locations, (location) => {
// strip the plural s
const singular = location.substring(0, location.length - 1);
_.each(httpRequest.parameters[location], (value, key) => {
parameters[`method.request.${singular}.${key}`] = value;
});
});
return parameters;
},
getRequestPassThrough(http) {
const requestPassThroughBehaviors = [
'NEVER', 'WHEN_NO_MATCH', 'WHEN_NO_TEMPLATES',
];
if (http.request.passThrough) {
if (requestPassThroughBehaviors.indexOf(http.request.passThrough) === -1) {
const errorMessage = [
'Request passThrough "',
http.request.passThrough,
'" is not one of ',
requestPassThroughBehaviors.join(', '),
].join('');
throw new this.serverless.classes.Error(errorMessage);
}
return http.request.passThrough;
}
// Validate() sets the passThrough default to NEVER. This is inappropriate
// for HTTP and MOCK integrations, where there is no default request template defined.
const type = http.integration || 'AWS_PROXY';
if (type === 'AWS') {
return requestPassThroughBehaviors[0];
} else if (type === 'HTTP' || type === 'MOCK') {
return undefined;
}
return 'WHEN_NO_MATCH';
},
getResponse(http) {
if (http.response) {
const response = http.response;
if (typeof response !== 'object') {
const errorMessage = [
'Response config must be provided as an object.',
' Please check the docs for more info.',
].join('');
throw new this.serverless.classes.Error(errorMessage);
}
if (response.headers && typeof response.headers !== 'object') {
const errorMessage = [
'Response headers must be provided as an object.',
' Please check the docs for more info.',
].join('');
throw new this.serverless.classes.Error(errorMessage);
}
if (response.statusCodes) {
response.statusCodes = _.assign({}, response.statusCodes);
if (!_.some(response.statusCodes, code => code.pattern === '')) {
response.statusCodes['200'] = DEFAULT_STATUS_CODES['200'];
}
} else {
response.statusCodes = DEFAULT_STATUS_CODES;
}
return response;
}
return {};
},
getLambdaArn(name) {
this.serverless.service.getFunction(name);
const lambdaLogicalId = this.provider.naming.getLambdaLogicalId(name);
return { 'Fn::GetAtt': [lambdaLogicalId, 'Arn'] };
},
getLambdaName(arn) {
const splitArn = arn.split(':');
const splitLambdaName = splitArn[splitArn.length - 1].split('-');
return splitLambdaName[splitLambdaName.length - 1];
},
};
|
const redis = require('redis');
const { promisify } = require('util');
// Create a client and connect to Redis.
const client = redis.createClient({
host: 'localhost',
port: 6379,
// password: 'password',
});
// Use Node's built in promisify to wrap the Redis
// command functions we are going to use in promises.
const setAsync = promisify(client.set).bind(client);
const getAsync = promisify(client.get).bind(client);
// Chain promises together to call Redis commands and
// process the results.
setAsync('hello', 'world')
.then(res => console.log(res)) // OK
.then(() => getAsync('hello'))
.then(res => console.log(res)) // world
.then(() => client.quit());
|
const bubbleSort = require('../sorting/bubbleSort.js');
const arr = [1, 2, 3, 4];
if (arr.join('') == bubbleSort([3, 4, 1, 2]).join('')) {
console.log('CONGRATION U DONE IT', bubbleSort(arr));
} else {
console.log('BETTER LUCK NEXT TIME!!!! hope u like disorderly arrays, pleb')
}
|
module.exports = function(hljs) {
var BASIC_ATOM_RE = '[a-z\'][a-zA-Z0-9_\']*';
var FUNCTION_NAME_RE = '(' + BASIC_ATOM_RE + ':' + BASIC_ATOM_RE + '|' + BASIC_ATOM_RE + ')';
var ERLANG_RESERVED = {
keyword:
'after and andalso|10 band begin bnot bor bsl bzr bxor case catch cond div end fun let ' +
'not of orelse|10 query receive rem try when xor',
literal:
'false true'
};
var COMMENT = {
className: 'comment',
begin: '%', end: '$',
relevance: 0
};
var NUMBER = {
className: 'number',
begin: '\\b(\\d+#[a-fA-F0-9]+|\\d+(\\.\\d+)?([eE][-+]?\\d+)?)',
relevance: 0
};
var NAMED_FUN = {
begin: 'fun\\s+' + BASIC_ATOM_RE + '/\\d+'
};
var FUNCTION_CALL = {
begin: FUNCTION_NAME_RE + '\\(', end: '\\)',
returnBegin: true,
relevance: 0,
contains: [
{
className: 'function_name', begin: FUNCTION_NAME_RE,
relevance: 0
},
{
begin: '\\(', end: '\\)', endsWithParent: true,
returnEnd: true,
relevance: 0
// "contains" defined later
}
]
};
var TUPLE = {
className: 'tuple',
begin: '{', end: '}',
relevance: 0
// "contains" defined later
};
var VAR1 = {
className: 'variable',
begin: '\\b_([A-Z][A-Za-z0-9_]*)?',
relevance: 0
};
var VAR2 = {
className: 'variable',
begin: '[A-Z][a-zA-Z0-9_]*',
relevance: 0
};
var RECORD_ACCESS = {
begin: '#', end: '}',
illegal: '.',
relevance: 0,
returnBegin: true,
contains: [
{
className: 'record_name',
begin: '#' + hljs.UNDERSCORE_IDENT_RE,
relevance: 0
},
{
begin: '{', endsWithParent: true,
relevance: 0
// "contains" defined later
}
]
};
var BLOCK_STATEMENTS = {
keywords: ERLANG_RESERVED,
begin: '(fun|receive|if|try|case)', end: 'end'
};
BLOCK_STATEMENTS.contains = [
COMMENT,
NAMED_FUN,
hljs.inherit(hljs.APOS_STRING_MODE, {className: ''}),
BLOCK_STATEMENTS,
FUNCTION_CALL,
hljs.QUOTE_STRING_MODE,
NUMBER,
TUPLE,
VAR1, VAR2,
RECORD_ACCESS
];
var BASIC_MODES = [
COMMENT,
NAMED_FUN,
BLOCK_STATEMENTS,
FUNCTION_CALL,
hljs.QUOTE_STRING_MODE,
NUMBER,
TUPLE,
VAR1, VAR2,
RECORD_ACCESS
];
FUNCTION_CALL.contains[1].contains = BASIC_MODES;
TUPLE.contains = BASIC_MODES;
RECORD_ACCESS.contains[1].contains = BASIC_MODES;
var PARAMS = {
className: 'params',
begin: '\\(', end: '\\)',
contains: BASIC_MODES
};
return {
keywords: ERLANG_RESERVED,
illegal: '(</|\\*=|\\+=|-=|/=|/\\*|\\*/|\\(\\*|\\*\\))',
contains: [
{
className: 'function',
begin: '^' + BASIC_ATOM_RE + '\\s*\\(', end: '->',
returnBegin: true,
illegal: '\\(|#|//|/\\*|\\\\|:',
contains: [
PARAMS,
{
className: 'title', begin: BASIC_ATOM_RE
}
],
starts: {
end: ';|\\.',
keywords: ERLANG_RESERVED,
contains: BASIC_MODES
}
},
COMMENT,
{
className: 'pp',
begin: '^-', end: '\\.',
relevance: 0,
excludeEnd: true,
returnBegin: true,
lexems: '-' + hljs.IDENT_RE,
keywords:
'-module -record -undef -export -ifdef -ifndef -author -copyright -doc -vsn ' +
'-import -include -include_lib -compile -define -else -endif -file -behaviour ' +
'-behavior',
contains: [PARAMS]
},
NUMBER,
hljs.QUOTE_STRING_MODE,
RECORD_ACCESS,
VAR1, VAR2,
TUPLE
]
};
};
|
import React from 'react';
import {mount} from 'enzyme';
import {MovieProfile} from '../../src/components';
const fetchResourceByUrl = jest.fn()
.mockImplementation((url) => {
return new Promise((resolve) => {
process.nextTick(() =>
resolve(['Sample Name'])
);
});
});
describe('MovieProfile component', () => {
it('should render child nodes', (done) => {
const props = {title:'Test', director:'Guy Homme'};
const wrapper = mount(<MovieProfile movie={props}/>);
wrapper.setState( {names: ['Some Name']});
expect((wrapper).contains(<h4 className='title'>{props.title}</h4>)).toBe(true);
expect((wrapper).contains(
<ul>
<li className='director'>Director: Guy Homme</li>
<li>Some Characters:
<p>Some Name</p>
</li>
</ul>
)).toBe(true);
done();
});
});
|
'use strict';
document.addEventListener('DOMContentLoaded', () => {
const scripts = document.getElementsByTagName('script');
const pattern = new RegExp('baidu|bdstatic');
let count = 0;
Array.from(scripts).forEach((current) => {
const parent = current.parentNode;
if (pattern.test(current.src) || pattern.test(current.innerHTML)) {
count++;
parent.removeChild(current);
}
});
if (count > 0) {
console.log('%cBye Bye Du removed ' + count + ' scripts.', 'color: #ffa500;');
}
});
|
import Ext_scroll_indicator_Indicator from '../../../Ext/scroll/indicator/Indicator.js';
export default class Ext_scroll_indicator_Overlay extends Ext_scroll_indicator_Indicator {
static PROPERTIES() { return [
'alignSelf',
'alwaysOnTop',
'ariaAttributes',
'ariaDescribedBy',
'ariaLabel',
'ariaLabelledBy',
'axis',
'bind',
'border',
'cls',
'constrainAlign',
'controller',
'defaultListenerScope',
'disabled',
'enabled',
'flex',
'floated',
'focusCls',
'height',
'hidden',
'hideAnimation',
'hideDelay',
'hideMode',
'id',
'instanceCls',
'itemId',
'keyMap',
'keyMapEnabled',
'keyMapTarget',
'listeners',
'margin',
'name',
'nameable',
'plugins',
'publishes',
'reference',
'relative',
'renderTo',
'ripple',
'scroller',
'session',
'shadow',
'shareableName',
'shim',
'style',
'toFrontOnShow',
'touchAction',
'translatable',
'twoWayBindable',
'ui',
'userCls',
'value',
'viewModel',
'width',
'x',
'y',
]};
static EVENTS() { return [
{name:'beforedisabledchange', parameters:'sender,value,oldValue,undefined'},
{name:'beforeheightchange', parameters:'sender,value,oldValue,undefined'},
{name:'beforehiddenchange', parameters:'sender,value,oldValue,undefined'},
{name:'beforetofront', parameters:'sender'},
{name:'beforewidthchange', parameters:'sender,value,oldValue,undefined'},
{name:'blur', parameters:'sender,event'},
{name:'disabledchange', parameters:'sender,value,oldValue'},
{name:'focus', parameters:'sender,event'},
{name:'focusenter', parameters:'sender,event'},
{name:'focusleave', parameters:'sender,event'},
{name:'heightchange', parameters:'sender,value,oldValue'},
{name:'hiddenchange', parameters:'sender,value,oldValue'},
{name:'tofront', parameters:'sender'},
{name:'widthchange', parameters:'sender,value,oldValue'},
{name:'ready', parameters:'cmp,cmpObj'},
{name:'created', parameters:'cmp'}
]};
static getProperties(properties) {
properties = properties.concat(Ext_scroll_indicator_Overlay.PROPERTIES());
return Ext_scroll_indicator_Indicator.getProperties(properties);
}
static getEvents(events) {
events = events.concat(Ext_scroll_indicator_Overlay.EVENTS());
return Ext_scroll_indicator_Indicator.getEvents(events);
}
static get observedAttributes() {
var attrs = super.observedAttributes
Ext_scroll_indicator_Overlay.PROPERTIES().forEach(function (property, index, array) {
attrs.push(property)
})
Ext_scroll_indicator_Overlay.EVENTS().forEach(function (eventparameter, index, array) {
attrs.push('on' + eventparameter.name)
})
return attrs
}
constructor(properties, events) {
super (
properties.concat(Ext_scroll_indicator_Overlay.PROPERTIES()),
events.concat(Ext_scroll_indicator_Overlay.EVENTS())
)
}
connectedCallback() {
super.connectedCallback()
}
attributeChangedCallback(attrName, oldVal, newVal) {
super.attributeChangedCallback(attrName, oldVal, newVal)
}
}
|
class Pawn extends Piece {
constructor(team, image) {
super(team, CHESS.Pawn, VALUE.Pawn, image);
}
getPossibleMoves(chessboard, grid, downward) {
let moves = [];
let possibleWays = [];
if (grid.get_piece() == null)
return moves;
let dir = downward ? 1 : -1;
if ((grid.y == 1 && dir == 1 || grid.y == 6 && dir == -1)
&& chessboard[grid.x][grid.y + dir].get_piece() == null
&& chessboard[grid.x][grid.y + dir * 2].get_piece() == null)
possibleWays.push({x:grid.x, y:grid.y + dir * 2});
if (Util.inBound(grid.y + dir) && Util.inBound(grid.x + 1) && chessboard[grid.x + 1][grid.y + dir].get_piece() != null)
possibleWays.push({x:grid.x + 1, y:grid.y + dir});
if (Util.inBound(grid.y + dir) && Util.inBound(grid.x - 1) && chessboard[grid.x - 1][grid.y + dir].get_piece() != null)
possibleWays.push({x:grid.x - 1, y:grid.y + dir});
if (Util.inBound(grid.y + dir) && Util.inBound(grid.x) && chessboard[grid.x][grid.y + dir].get_piece() == null)
possibleWays.push({x:grid.x, y:grid.y + dir});
for (let j = 0; j < possibleWays.length; j++) {
let move = Util.checkPosition(possibleWays[j]);
if (move != null) {
let target = chessboard[move.x][move.y];
if (target.get_piece() == null)
moves.push(Object.assign({}, move));
else {
if (target.get_piece().team != grid.get_piece().team)
moves.push(Object.assign({}, move));
possibleWays[j] = null;
}
}
}
return moves;
}
}
|
const REGISTRY = {}
export function registerMethod (method, resolver) {
REGISTRY[method] = resolver
}
export function parse (did) {
if (!did || did === '') throw new Error('Missing DID')
const sections = did.match(/^did:([a-zA-Z0-9]+):([[a-zA-Z0-9.-]+)(\/[^#]*)?(#.*)?$/)
if (sections) {
const parts = {did: sections[0], method: sections[1], id: sections[2]}
if (sections[3]) parts.path = sections[3]
if (sections[4]) parts.fragment = sections[4].slice(1)
return parts
}
throw new Error(`Invalid DID ${did}`)
}
export function resolve (did) {
return new Promise((resolve, reject) => {
const parsed = parse(did)
const resolver = REGISTRY[parsed.method]
if (resolver) {
return resolver(did, parsed).then(resolve, reject)
}
reject(new Error(`Unsupported DID method: '${parsed.method}'`))
})
}
export default resolve
resolve.registerMethod = registerMethod
resolve.parse = parse
module.exports = resolve
|
$(document).ready(function(){
// autoplay on video modals
$('.modal.sa-video').on('shown.bs.modal', function () {
var video_id = "#" + $(this).attr("id") + "_video";
$(video_id)[0].play();
});
$('.modal.sa-video').on('hidden.bs.modal', function () {
var video_id = "#" + $(this).attr("id") + "_video";
$(video_id)[0].pause();
});
// navbar scroll functions
$(window).scroll(function(e) {
// add/remove class to navbar when scrolling to hide/show
$('.main-navbar')[$(window).scrollTop() >= 150 ? 'addClass' : 'removeClass']('navbar-hide');
});
});
|
/**
@namespace
*/
JSDOC.Util = {
}
/**
* Turn a path into just the name of the file.
*/
JSDOC.Util.fileName = function(path) {
var nameStart = Math.max(path.lastIndexOf("/")+1, path.lastIndexOf("\\")+1, 0);
return path.substring(nameStart);
}
/**
* Turn a path into just the directory part.
*/
JSDOC.Util.dir = function(path) {
var nameStart = Math.max(path.lastIndexOf("/")+1, path.lastIndexOf("\\")+1, 0);
return path.substring(0, nameStart-1);
}
/**
* Get commandline option values.
* @static
* @param {Array} args Commandline arguments. Like ["-a=xml", "-b", "--class=new", "--debug"]
* @param {object} optNames Map short names to long names. Like {a:"accept", b:"backtrace", c:"class", d:"debug"}.
* @return {object} Short names and values. Like {a:"xml", b:true, c:"new", d:true}
*/
JSDOC.Util.getOptions = function(args, optNames) {
var opt = {"_": []}; // the unnamed option allows multiple values
for (var i = 0; i < args.length; i++) {
var arg = new String(args[i]);
var name;
var value;
if (arg.charAt(0) == "-") {
if (arg.charAt(1) == "-") { // it's a longname like --foo
arg = arg.substring(2);
var m = arg.split("=");
name = m.shift();
value = m.shift();
if (typeof value == "undefined") value = true;
for (var n in optNames) { // convert it to a shortname
if (name == optNames[n]) {
name = n;
}
}
}
else { // it's a shortname like -f
arg = arg.substring(1);
var m = arg.split("=");
name = m.shift();
value = m.shift();
if (typeof value == "undefined") value = true;
for (var n in optNames) { // find the matching key
if (name == n || name+'[]' == n) {
name = n;
break;
}
}
}
if (name.match(/(.+)\[\]$/)) { // it's an array type like n[]
name = RegExp.$1;
if (!opt[name]) opt[name] = [];
}
if (opt[name] && opt[name].push) {
opt[name].push(value);
}
else {
opt[name] = value;
}
}
else { // not associated with any optname
opt._.push(args[i]);
}
}
return opt;
}
|
import { DeployUtil, Signer, RuntimeArgs, CLValueBuilder, CLAccountHash, CLKey, CLTypeBuilder } from 'casper-js-sdk';
import { NETWORK_NAME, PAYMENT_AMOUNT, MOTE_RATE, DEPLOY_TTL_MS } from '../constants/key';
/**
* Get Transfer deploy
* @param {CLPublicKey} fromAccount main account public key
* @param {CLPublicKey} toAccount public key of target account
* @param {Number} amount transfer amount
* @param {Number} transferId transfer id. This parameter is optional
* @param {Number} fee transfer fee
* @returns {Deploy} transfer deploy
*/
export const buildTransferDeploy = (fromAccount, toAccount, amount, transferId, fee) => {
const deployParams = new DeployUtil.DeployParams(fromAccount, NETWORK_NAME);
const transferParams = DeployUtil.ExecutableDeployItem.newTransfer(amount, toAccount, null, transferId);
const payment = DeployUtil.standardPayment(fee * MOTE_RATE);
return DeployUtil.makeDeploy(deployParams, transferParams, payment);
};
/**
* Build deploy for contract
* @param {CLPublicKey} baseAccount main account public key
* @param {Object} session hash contract content
* @returns {Deploy} deploy of the contract
*/
export const buildContractInstallDeploy = (baseAccount, session) => {
const deployParams = new DeployUtil.DeployParams(baseAccount, NETWORK_NAME);
const payment = DeployUtil.standardPayment(PAYMENT_AMOUNT);
return DeployUtil.makeDeploy(deployParams, session, payment);
};
/**
* Sign a deploy by singer
* @param {Deploy} deploy main account public key
* @param {String} mainAccountHex hash contract content
* @param {String} setAccountHex contract's arguments
* @param {Object} ledgerOptions ledger's options
* @returns {Deploy} Signed deploy
*/
export const signDeployByCasperSigner = async (deploy, mainAccountHex, setAccountHex) => {
const deployObj = DeployUtil.deployToJson(deploy);
const signedDeploy = await Signer.sign(deployObj, mainAccountHex, setAccountHex);
return signedDeploy;
};
/**
* Get Recipient address
* @param {CLPublicKey} recipient
*/
export const createRecipientAddress = (recipient) => {
return new CLKey(new CLAccountHash(recipient.toAccountHash()));
};
/**
* Get Transfer Token deploy
* @param {CLPublicKey} fromAccount from account public key
* @param {CLPublicKey} toAccount to account public key
* @param {Number} amount transfer amount
* @param {String} contractHash token contract hash
* @returns {Deploy} transfer deploy
*/
export const buildTransferTokenDeploy = (fromAccount, toAccount, amount, contractHash, fee) => {
const contractHashAsByteArray = [...Buffer.from(contractHash, 'hex')];
const deployParams = new DeployUtil.DeployParams(fromAccount, NETWORK_NAME, 1, DEPLOY_TTL_MS);
const transferParams = DeployUtil.ExecutableDeployItem.newStoredContractByHash(
contractHashAsByteArray,
'transfer',
RuntimeArgs.fromMap({
amount: CLValueBuilder.u256(amount),
recipient: createRecipientAddress(toAccount),
}),
);
const payment = DeployUtil.standardPayment(fee * MOTE_RATE);
return DeployUtil.makeDeploy(deployParams, transferParams, payment);
};
/**
* Request to connect with signer
* @returns {string} error message
*/
export const connectCasperSigner = () => {
try {
Signer.sendConnectionRequest();
} catch (error) {
return error.message;
}
};
/**
* It takes a JavaScript map and returns a CLValue of type `Map<String, String>`
* @param map - The map to convert to a CLValue.
* @returns A CLValue of type `Map<String, String>`
*/
export const toCLMap = (map) => {
const clMap = CLValueBuilder.map([CLTypeBuilder.string(), CLTypeBuilder.string()]);
for (const [key, value] of Array.from(map.entries())) {
clMap.set(CLValueBuilder.string(key), CLValueBuilder.string(value));
}
return clMap;
};
/**
* Convert a contract hash to a byte array
* @param contractHash - The contract hash of the contract you want to get the bytecode of.
*/
export const contractHashToByteArray = (contractHash) => Uint8Array.from(Buffer.from(contractHash, 'hex'));
|
import Phaser, { Button } from 'phaser'
import { centerGameObjects } from '../../utils'
import BackButton from '../../components/BackButton'
export default class extends Phaser.State {
init () { }
preload () {
}
create () {
this.phoneBg = this.add.sprite(0, 0, 'phoneBg')
this.settingsButton = new Button(this.game, 576, 399, 'settings', () => {
this.state.start('SettingsScreen')
})
this.contactsButton = new Button(this.game, 576, 719, 'contacts', () => this.state.start('ContactsScreen'))
this.game.add.existing(this.settingsButton)
this.game.add.existing(this.contactsButton)
BackButton.addButton(this.game, this.state, 'Game', 'close')
}
// render () {
// this.game.debug.spriteInfo(this.settingsButton, 32, 32)
// this.game.debug.spriteInfo(this.contactsButton, 102, 102)
// }
}
|
import Ruler from "./ruler.js";
import { onReady } from "./dom.js";
/** Class for FontFaceObserver. */
class FontFaceObserver {
static Ruler = Ruler;
/**
* @type {null|boolean}
*/
static HAS_WEBKIT_FALLBACK_BUG = null;
/**
* @type {null|boolean}
*/
static HAS_SAFARI_10_BUG = null;
/**
* @type {null|boolean}
*/
static SUPPORTS_STRETCH = null;
/**
* @type {null|boolean}
*/
static SUPPORTS_NATIVE_FONT_LOADING = null;
/**
* @type {number}
*/
static DEFAULT_TIMEOUT = 3000;
/**
* @return {string}
*/
static getUserAgent() {
return window.navigator.userAgent;
}
/**
* @return {string}
*/
static getNavigatorVendor() {
return window.navigator.vendor;
}
/**
* Returns true if this browser is WebKit and it has the fallback bug which is
* present in WebKit 536.11 and earlier.
*
* @return {boolean}
*/
static hasWebKitFallbackBug() {
if (FontFaceObserver.HAS_WEBKIT_FALLBACK_BUG === null) {
const match = /AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(
FontFaceObserver.getUserAgent()
);
FontFaceObserver.HAS_WEBKIT_FALLBACK_BUG =
!!match &&
(parseInt(match[1], 10) < 536 ||
(parseInt(match[1], 10) === 536 && parseInt(match[2], 10) <= 11));
}
return FontFaceObserver.HAS_WEBKIT_FALLBACK_BUG;
}
/**
* Returns true if the browser has the Safari 10 bugs. The native font load
* API in Safari 10 has two bugs that cause the document.fonts.load and
* FontFace.prototype.load methods to return promises that don't reliably get
* settled.
*
* The bugs are described in more detail here:
* - https://bugs.webkit.org/show_bug.cgi?id=165037
* - https://bugs.webkit.org/show_bug.cgi?id=164902
*
* If the browser is made by Apple, and has native font loading support, it is
* potentially affected. But the API was fixed around AppleWebKit version 603,
* so any newer versions that that does not contain the bug.
*
* @return {boolean}
*/
static hasSafari10Bug() {
if (FontFaceObserver.HAS_SAFARI_10_BUG === null) {
if (
FontFaceObserver.supportsNativeFontLoading() &&
/Apple/.test(FontFaceObserver.getNavigatorVendor())
) {
const match = /AppleWebKit\/([0-9]+)(?:\.([0-9]+))(?:\.([0-9]+))/.exec(
FontFaceObserver.getUserAgent()
);
FontFaceObserver.HAS_SAFARI_10_BUG =
!!match && parseInt(match[1], 10) < 603;
} else {
FontFaceObserver.HAS_SAFARI_10_BUG = false;
}
}
return FontFaceObserver.HAS_SAFARI_10_BUG;
}
/**
* Returns true if the browser supports the native font loading API.
*
* @return {boolean}
*/
static supportsNativeFontLoading() {
if (FontFaceObserver.SUPPORTS_NATIVE_FONT_LOADING === null) {
FontFaceObserver.SUPPORTS_NATIVE_FONT_LOADING = !!document["fonts"];
}
return FontFaceObserver.SUPPORTS_NATIVE_FONT_LOADING;
}
/**
* Returns true if the browser supports font-style in the font short-hand
* syntax.
*
* @return {boolean}
*/
static supportStretch() {
if (FontFaceObserver.SUPPORTS_STRETCH === null) {
const div = document.createElement("div");
try {
div.style.font = "condensed 100px sans-serif";
} catch (e) {}
FontFaceObserver.SUPPORTS_STRETCH = div.style.font !== "";
}
return FontFaceObserver.SUPPORTS_STRETCH;
}
/**
* @typedef {Object} Descriptors
* @property {string|undefined} style
* @property {string|undefined} weight
* @property {string|undefined} stretch
*/
/**
*
* @param {string} family font-family name (required)
* @param {Descriptors} descriptors an object describing the variation
* (optional). The object can contain `weight`, `style`, and `stretch`
* properties. If a property is not present it will default to `normal`.
*/
constructor(family, descriptors = {}) {
this.family = family;
this.style = descriptors.style || "normal";
this.weight = descriptors.weight || "normal";
this.stretch = descriptors.stretch || "normal";
return this;
}
/**
* @param {string=} text Optional test string to use for detecting if a font
* is available.
* @param {number=} timeout Optional timeout for giving up on font load
* detection and rejecting the promise (defaults to 3 seconds).
* @return {Promise.<FontFaceObserver>}
*/
load(text, timeout) {
const that = this;
const testString = text || "BESbswy";
let timeoutId = 0;
const timeoutValue = timeout || FontFaceObserver.DEFAULT_TIMEOUT;
const start = that.getTime();
return new Promise(function(resolve, reject) {
if (
FontFaceObserver.supportsNativeFontLoading() &&
!FontFaceObserver.hasSafari10Bug()
) {
const loader = new Promise(function(resolve, reject) {
const check = function() {
const now = that.getTime();
if (now - start >= timeoutValue) {
reject(new Error("" + timeoutValue + "ms timeout exceeded"));
} else {
document.fonts
.load(that.getStyle('"' + that["family"] + '"'), testString)
.then(function(fonts) {
if (fonts.length >= 1) {
resolve();
} else {
setTimeout(check, 25);
}
}, reject);
}
};
check();
});
const timer = new Promise(function(resolve, reject) {
timeoutId = setTimeout(function() {
reject(new Error("" + timeoutValue + "ms timeout exceeded"));
}, timeoutValue);
});
Promise.race([timer, loader]).then(function() {
clearTimeout(timeoutId);
resolve(that);
}, reject);
} else {
onReady(function() {
const rulerA = new Ruler(testString);
const rulerB = new Ruler(testString);
const rulerC = new Ruler(testString);
let widthA = -1;
let widthB = -1;
let widthC = -1;
let fallbackWidthA = -1;
let fallbackWidthB = -1;
let fallbackWidthC = -1;
const container = document.createElement("div");
/**
* @private
*/
function removeContainer() {
if (container.parentNode !== null) {
container.parentNode.removeChild(container);
}
}
/**
* @private
*
* If metric compatible fonts are detected, one of the widths will be
* -1. This is because a metric compatible font won't trigger a scroll
* event. We work around this by considering a font loaded if at least
* two of the widths are the same. Because we have three widths, this
* still prevents false positives.
*
* Cases:
* 1) Font loads: both a, b and c are called and have the same value.
* 2) Font fails to load: resize callback is never called and timeout
* happens.
* 3) WebKit bug: both a, b and c are called and have the same value,
* but the values are equal to one of the last resort fonts, we
* ignore this and continue waiting until we get new values (or a
* timeout).
*/
function check() {
if (
(widthA != -1 && widthB != -1) ||
(widthA != -1 && widthC != -1) ||
(widthB != -1 && widthC != -1)
) {
if (widthA == widthB || widthA == widthC || widthB == widthC) {
// All values are the same, so the browser has most likely
// loaded the web font
if (FontFaceObserver.hasWebKitFallbackBug()) {
// Except if the browser has the WebKit fallback bug, in which
// case we check to see if all values are set to one of the
// last resort fonts.
if (
(widthA == fallbackWidthA &&
widthB == fallbackWidthA &&
widthC == fallbackWidthA) ||
(widthA == fallbackWidthB &&
widthB == fallbackWidthB &&
widthC == fallbackWidthB) ||
(widthA == fallbackWidthC &&
widthB == fallbackWidthC &&
widthC == fallbackWidthC)
) {
// The width we got matches some of the known last resort
// fonts, so let's assume we're dealing with the last resort
// font.
return;
}
}
removeContainer();
clearTimeout(timeoutId);
resolve(that);
}
}
}
// This ensures the scroll direction is correct.
container.dir = "ltr";
rulerA.setFont(that.getStyle("sans-serif"));
rulerB.setFont(that.getStyle("serif"));
rulerC.setFont(that.getStyle("monospace"));
container.appendChild(rulerA.getElement());
container.appendChild(rulerB.getElement());
container.appendChild(rulerC.getElement());
document.body.appendChild(container);
fallbackWidthA = rulerA.getWidth();
fallbackWidthB = rulerB.getWidth();
fallbackWidthC = rulerC.getWidth();
function checkForTimeout() {
const now = that.getTime();
if (now - start >= timeoutValue) {
removeContainer();
reject(new Error("" + timeoutValue + "ms timeout exceeded"));
} else {
const hidden = document["hidden"];
if (hidden === true || hidden === undefined) {
widthA = rulerA.getWidth();
widthB = rulerB.getWidth();
widthC = rulerC.getWidth();
check();
}
timeoutId = setTimeout(checkForTimeout, 50);
}
}
checkForTimeout();
rulerA.onResize(function(width) {
widthA = width;
check();
});
rulerA.setFont(that.getStyle('"' + that["family"] + '",sans-serif'));
rulerB.onResize(function(width) {
widthB = width;
check();
});
rulerB.setFont(that.getStyle('"' + that["family"] + '",serif'));
rulerC.onResize(function(width) {
widthC = width;
check();
});
rulerC.setFont(that.getStyle('"' + that["family"] + '",monospace'));
});
}
});
}
/**
* @private
*
* @param {string} family
* @return {string}
*/
getStyle(family) {
return [
this.style,
this.weight,
FontFaceObserver.supportStretch() ? this.stretch : "",
"100px",
family
].join(" ");
}
/**
* @private
*
* @return {number}
*/
getTime() {
return new Date().getTime();
}
}
export default FontFaceObserver;
|
import sendgridMail from '@sendgrid/mail'
sendgridMail.setApiKey(process.env.SENDGRID_KEY)
export const sendMail = (toEmail, subject, content) => {
const msg = {
to: toEmail,
from: process.env.DEFAULT_EMAIL,
subject,
html: content
}
return sendgridMail.send(msg)
}
|
import { NotImplementedError } from '../extensions/index.js';
/**
* Calculate turns number and time (in seconds) required
* to solve puzzle
*
* @param {Number} disks number of disks
* @param {Number} turnsSpeed speed (in turns/hour)
* @return {Object} object with props turns (number of turns)
* and seconds (time in seconds)
*
* @example
*
* calculateHanoi(9, 4308) => { turns: 511, seconds: 427 }
*
*/
export default function calculateHanoi(disksNumber, turnsSpeed) {
const turns = Math.pow(2, disksNumber) - 1;
const seconds = Math.floor(turns * 3600 / turnsSpeed);
return { turns, seconds };
}
|
(window.webpackJsonp=window.webpackJsonp||[]).push([[45],{112:function(n,e,t){"use strict";t.r(e),t.d(e,"frontMatter",(function(){return s})),t.d(e,"metadata",(function(){return r})),t.d(e,"toc",(function(){return l})),t.d(e,"default",(function(){return c}));var a=t(3),o=t(8),i=(t(0),t(572)),s={id:"configuration",title:"Configuration"},r={unversionedId:"reference/configuration",id:"version-v1.4/reference/configuration",isDocsHomePage:!1,title:"Configuration",description:"\x3c!-- THIS FILE IS BEING AUTO-GENERATED. DO NOT MODIFY IT AS ALL CHANGES WILL BE OVERWRITTEN.",source:"@site/versioned_docs/version-v1.4/reference/configuration.md",sourceDirName:"reference",slug:"/reference/configuration",permalink:"/hydra/docs/v1.4/reference/configuration",editUrl:"https://github.com/ory/hydra/edit/master/docs/versioned_docs/version-v1.4/reference/configuration.md",version:"v1.4",lastUpdatedBy:"aeneasr",lastUpdatedAt:1587812961,formattedLastUpdatedAt:"4/25/2020",frontMatter:{id:"configuration",title:"Configuration"},sidebar:"version-v1.4/docs",previous:{title:"Consuming OAuth 2.0",permalink:"/hydra/docs/v1.4/integration"},next:{title:"REST API",permalink:"/hydra/docs/v1.4/reference/api"}},l=[],u={toc:l};function c(n){var e=n.components,t=Object(o.a)(n,["components"]);return Object(i.b)("wrapper",Object(a.a)({},u,t,{components:e,mdxType:"MDXLayout"}),Object(i.b)("p",null,"If file ",Object(i.b)("inlineCode",{parentName:"p"},"$HOME/.hydra.yaml")," exists, it will be used as a configuration file which supports all\nconfiguration settings listed below."),Object(i.b)("p",null,"You can load the config file from another source using the ",Object(i.b)("inlineCode",{parentName:"p"},"-c path/to/config.yaml")," or ",Object(i.b)("inlineCode",{parentName:"p"},"--config path/to/config.yaml"),"\nflag: ",Object(i.b)("inlineCode",{parentName:"p"},"hydra --config path/to/config.yaml"),"."),Object(i.b)("p",null,"Config files can be formatted as JSON, YAML and TOML. Some configuration values support reloading without server restart.\nAll configuration values can be set using environment variables, as documented below."),Object(i.b)("p",null,"To find out more about edge cases like setting string array values through environmental variables head to the\n",Object(i.b)("a",{parentName:"p",href:"https://www.ory.sh/docs/ecosystem/configuring"},"Configuring ORY services")," section."),Object(i.b)("pre",null,Object(i.b)("code",{parentName:"pre",className:"language-yaml"},'## ORY Hydra Configuration\n#\n\n\n## log ##\n#\n# Configures the logger\n#\nlog:\n \n ## level ##\n #\n # Sets the log level.\n #\n # Default value: info\n #\n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export LOG_LEVEL=<value>\n # - Windows Command Line (CMD):\n # > set LOG_LEVEL=<value>\n #\n level: trace\n\n ## format ##\n #\n # Sets the log format.\n #\n # Default value: text\n #\n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export LOG_FORMAT=<value>\n # - Windows Command Line (CMD):\n # > set LOG_FORMAT=<value>\n #\n format: json\n\n## serve ##\n#\n# Controls the configuration for the http(s) daemon(s).\n#\nserve:\n \n ## public ##\n #\n # Controls the public daemon serving public API endpoints like /oauth2/auth, /oauth2/token, /.well-known/jwks.json\n #\n public:\n \n ## port ##\n #\n # Default value: 4444\n #\n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export SERVE_PUBLIC_PORT=<value>\n # - Windows Command Line (CMD):\n # > set SERVE_PUBLIC_PORT=<value>\n #\n port: 51721\n\n ## host ##\n #\n # The interface or unix socket ORY Hydra should listen and handle public API requests on. Use the prefix "unix:" to specify a path to a unix socket. Leave empty to listen on all interfaces.\n #\n # Examples:\n # - localhost\n # \n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export SERVE_PUBLIC_HOST=<value>\n # - Windows Command Line (CMD):\n # > set SERVE_PUBLIC_HOST=<value>\n #\n host: localhost\n\n ## cors ##\n #\n # Configures Cross Origin Resource Sharing for public endpoints.\n #\n cors:\n \n ## enabled ##\n #\n # Sets whether CORS is enabled.\n #\n # Default value: false\n #\n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export SERVE_PUBLIC_CORS_ENABLED=<value>\n # - Windows Command Line (CMD):\n # > set SERVE_PUBLIC_CORS_ENABLED=<value>\n #\n enabled: true\n\n ## allowed_origins ##\n #\n # A list of origins a cross-domain request can be executed from. If the special * value is present in the list, all origins will be allowed. An origin may contain a wildcard (*) to replace 0 or more characters (i.e.: http://*.domain.com). Only one wildcard can be used per origin.\n #\n # Default value: *\n #\n # Examples:\n # - - https://example.com\n # - https://*.example.com\n # - https://*.foo.example.com\n # \n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export SERVE_PUBLIC_CORS_ALLOWED_ORIGINS=<value>\n # - Windows Command Line (CMD):\n # > set SERVE_PUBLIC_CORS_ALLOWED_ORIGINS=<value>\n #\n allowed_origins:\n - https://example.com\n - https://*.example.com\n - https://*.foo.example.com\n\n ## allowed_methods ##\n #\n # A list of HTTP methods the user agent is allowed to use with cross-domain requests.\n #\n # Default value: POST,GET,PUT,PATCH,DELETE\n #\n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export SERVE_PUBLIC_CORS_ALLOWED_METHODS=<value>\n # - Windows Command Line (CMD):\n # > set SERVE_PUBLIC_CORS_ALLOWED_METHODS=<value>\n #\n allowed_methods:\n - GET\n - GET\n\n ## allowed_headers ##\n #\n # A list of non simple headers the client is allowed to use with cross-domain requests.\n #\n # Default value: Authorization,Content-Type\n #\n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export SERVE_PUBLIC_CORS_ALLOWED_HEADERS=<value>\n # - Windows Command Line (CMD):\n # > set SERVE_PUBLIC_CORS_ALLOWED_HEADERS=<value>\n #\n allowed_headers:\n - commodo eu et dolore ad\n - eiusmod\n - aliqua nulla aute sint labore\n - eu eiusmod\n\n ## exposed_headers ##\n #\n # Sets which headers are safe to expose to the API of a CORS API specification.\n #\n # Default value: Content-Type\n #\n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export SERVE_PUBLIC_CORS_EXPOSED_HEADERS=<value>\n # - Windows Command Line (CMD):\n # > set SERVE_PUBLIC_CORS_EXPOSED_HEADERS=<value>\n #\n exposed_headers:\n - ad\n - velit\n - nostrud\n\n ## allow_credentials ##\n #\n # Sets whether the request can include user credentials like cookies, HTTP authentication or client side SSL certificates.\n #\n # Default value: true\n #\n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export SERVE_PUBLIC_CORS_ALLOW_CREDENTIALS=<value>\n # - Windows Command Line (CMD):\n # > set SERVE_PUBLIC_CORS_ALLOW_CREDENTIALS=<value>\n #\n allow_credentials: false\n\n ## options_passthrough ##\n #\n # TODO\n #\n # Default value: false\n #\n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export SERVE_PUBLIC_CORS_OPTIONS_PASSTHROUGH=<value>\n # - Windows Command Line (CMD):\n # > set SERVE_PUBLIC_CORS_OPTIONS_PASSTHROUGH=<value>\n #\n options_passthrough: true\n\n ## max_age ##\n #\n # Sets how long (in seconds) the results of a preflight request can be cached. If set to 0, every request is preceded by a preflight request.\n #\n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export SERVE_PUBLIC_CORS_MAX_AGE=<value>\n # - Windows Command Line (CMD):\n # > set SERVE_PUBLIC_CORS_MAX_AGE=<value>\n #\n max_age: 86527639\n\n ## debug ##\n #\n # Adds additional log output to debug server side CORS issues.\n #\n # Default value: false\n #\n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export SERVE_PUBLIC_CORS_DEBUG=<value>\n # - Windows Command Line (CMD):\n # > set SERVE_PUBLIC_CORS_DEBUG=<value>\n #\n debug: false\n\n ## access_log ##\n #\n # Access Log configuration for public server.\n #\n access_log:\n \n ## disable_for_health ##\n #\n # Disable access log for health endpoints.\n #\n # Default value: false\n #\n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export SERVE_PUBLIC_ACCESS_LOG_DISABLE_FOR_HEALTH=<value>\n # - Windows Command Line (CMD):\n # > set SERVE_PUBLIC_ACCESS_LOG_DISABLE_FOR_HEALTH=<value>\n #\n disable_for_health: false\n\n ## admin ##\n #\n admin:\n \n ## port ##\n #\n # Default value: 4445\n #\n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export SERVE_ADMIN_PORT=<value>\n # - Windows Command Line (CMD):\n # > set SERVE_ADMIN_PORT=<value>\n #\n port: 55165\n\n ## host ##\n #\n # The interface or unix socket ORY Hydra should listen and handle administrative API requests on. Use the prefix "unix:" to specify a path to a unix socket. Leave empty to listen on all interfaces.\n #\n # Examples:\n # - localhost\n # \n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export SERVE_ADMIN_HOST=<value>\n # - Windows Command Line (CMD):\n # > set SERVE_ADMIN_HOST=<value>\n #\n host: localhost\n\n ## cors ##\n #\n # Configures Cross Origin Resource Sharing for public endpoints.\n #\n cors:\n \n ## enabled ##\n #\n # Sets whether CORS is enabled.\n #\n # Default value: false\n #\n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export SERVE_ADMIN_CORS_ENABLED=<value>\n # - Windows Command Line (CMD):\n # > set SERVE_ADMIN_CORS_ENABLED=<value>\n #\n enabled: false\n\n ## allowed_origins ##\n #\n # A list of origins a cross-domain request can be executed from. If the special * value is present in the list, all origins will be allowed. An origin may contain a wildcard (*) to replace 0 or more characters (i.e.: http://*.domain.com). Only one wildcard can be used per origin.\n #\n # Default value: *\n #\n # Examples:\n # - - https://example.com\n # - https://*.example.com\n # - https://*.foo.example.com\n # \n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export SERVE_ADMIN_CORS_ALLOWED_ORIGINS=<value>\n # - Windows Command Line (CMD):\n # > set SERVE_ADMIN_CORS_ALLOWED_ORIGINS=<value>\n #\n allowed_origins:\n - "*"\n\n ## allowed_methods ##\n #\n # A list of HTTP methods the user agent is allowed to use with cross-domain requests.\n #\n # Default value: POST,GET,PUT,PATCH,DELETE\n #\n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export SERVE_ADMIN_CORS_ALLOWED_METHODS=<value>\n # - Windows Command Line (CMD):\n # > set SERVE_ADMIN_CORS_ALLOWED_METHODS=<value>\n #\n allowed_methods:\n - GET\n - OPTIONS\n - DELETE\n - POST\n\n ## allowed_headers ##\n #\n # A list of non simple headers the client is allowed to use with cross-domain requests.\n #\n # Default value: Authorization,Content-Type\n #\n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export SERVE_ADMIN_CORS_ALLOWED_HEADERS=<value>\n # - Windows Command Line (CMD):\n # > set SERVE_ADMIN_CORS_ALLOWED_HEADERS=<value>\n #\n allowed_headers:\n - in ex cupidatat culpa\n\n ## exposed_headers ##\n #\n # Sets which headers are safe to expose to the API of a CORS API specification.\n #\n # Default value: Content-Type\n #\n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export SERVE_ADMIN_CORS_EXPOSED_HEADERS=<value>\n # - Windows Command Line (CMD):\n # > set SERVE_ADMIN_CORS_EXPOSED_HEADERS=<value>\n #\n exposed_headers:\n - elit\n - ad amet consequat incididunt\n\n ## allow_credentials ##\n #\n # Sets whether the request can include user credentials like cookies, HTTP authentication or client side SSL certificates.\n #\n # Default value: true\n #\n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export SERVE_ADMIN_CORS_ALLOW_CREDENTIALS=<value>\n # - Windows Command Line (CMD):\n # > set SERVE_ADMIN_CORS_ALLOW_CREDENTIALS=<value>\n #\n allow_credentials: true\n\n ## options_passthrough ##\n #\n # TODO\n #\n # Default value: false\n #\n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export SERVE_ADMIN_CORS_OPTIONS_PASSTHROUGH=<value>\n # - Windows Command Line (CMD):\n # > set SERVE_ADMIN_CORS_OPTIONS_PASSTHROUGH=<value>\n #\n options_passthrough: true\n\n ## max_age ##\n #\n # Sets how long (in seconds) the results of a preflight request can be cached. If set to 0, every request is preceded by a preflight request.\n #\n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export SERVE_ADMIN_CORS_MAX_AGE=<value>\n # - Windows Command Line (CMD):\n # > set SERVE_ADMIN_CORS_MAX_AGE=<value>\n #\n max_age: 48526543\n\n ## debug ##\n #\n # Adds additional log output to debug server side CORS issues.\n #\n # Default value: false\n #\n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export SERVE_ADMIN_CORS_DEBUG=<value>\n # - Windows Command Line (CMD):\n # > set SERVE_ADMIN_CORS_DEBUG=<value>\n #\n debug: false\n\n ## access_log ##\n #\n # Access Log configuration for admin server.\n #\n access_log:\n \n ## disable_for_health ##\n #\n # Disable access log for health endpoints.\n #\n # Default value: false\n #\n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export SERVE_ADMIN_ACCESS_LOG_DISABLE_FOR_HEALTH=<value>\n # - Windows Command Line (CMD):\n # > set SERVE_ADMIN_ACCESS_LOG_DISABLE_FOR_HEALTH=<value>\n #\n disable_for_health: false\n\n ## tls ##\n #\n # Configures HTTPS (HTTP over TLS). If configured, the server automatically supports HTTP/2.\n #\n tls:\n \n ## key ##\n #\n # Configures the private key (pem encoded).\n #\n key:\n \n ## path ##\n #\n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export SERVE_TLS_KEY_PATH=<value>\n # - Windows Command Line (CMD):\n # > set SERVE_TLS_KEY_PATH=<value>\n #\n path: /path/to/file.pem\n\n ## cert ##\n #\n # Configures the private key (pem encoded).\n #\n cert:\n \n ## path ##\n #\n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export SERVE_TLS_CERT_PATH=<value>\n # - Windows Command Line (CMD):\n # > set SERVE_TLS_CERT_PATH=<value>\n #\n path: /path/to/file.pem\n\n ## allow_termination_from ##\n #\n # Whitelist one or multiple CIDR address ranges and allow them to terminate TLS connections. Be aware that the X-Forwarded-Proto header must be set and must never be modifiable by anyone but your proxy / gateway / load balancer. Supports ipv4 and ipv6. Hydra serves http instead of https when this option is set.\n #\n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export SERVE_TLS_ALLOW_TERMINATION_FROM=<value>\n # - Windows Command Line (CMD):\n # > set SERVE_TLS_ALLOW_TERMINATION_FROM=<value>\n #\n allow_termination_from:\n - 127.0.0.1/32\n\n ## cookies ##\n #\n cookies:\n \n ## same_site_mode ##\n #\n # Specify the SameSite mode that cookies should be sent with.\n #\n # Default value: None\n #\n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export SERVE_COOKIES_SAME_SITE_MODE=<value>\n # - Windows Command Line (CMD):\n # > set SERVE_COOKIES_SAME_SITE_MODE=<value>\n #\n same_site_mode: Lax\n\n ## same_site_legacy_workaround ##\n #\n # Some older browser versions don\u2019t work with SameSite=None. This option enables the workaround defined in https://web.dev/samesite-cookie-recipes/ which essentially stores a second cookie without SameSite as a fallback.\n #\n # Default value: false\n #\n # Examples:\n # - true\n # \n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export SERVE_COOKIES_SAME_SITE_LEGACY_WORKAROUND=<value>\n # - Windows Command Line (CMD):\n # > set SERVE_COOKIES_SAME_SITE_LEGACY_WORKAROUND=<value>\n #\n same_site_legacy_workaround: false\n\n## dsn ##\n#\n# Sets the data source name. This configures the backend where ORY Hydra persists data. If dsn is "memory", data will be written to memory and is lost when you restart this instance. ORY Hydra supports popular SQL databases. For more detailed configuration information go to: https://www.ory.sh/docs/hydra/dependencies-environment#sql\n#\n# Set this value using environment variables on\n# - Linux/macOS:\n# $ export DSN=<value>\n# - Windows Command Line (CMD):\n# > set DSN=<value>\n#\ndsn: reprehenderit quis\n\n## webfinger ##\n#\n# Configures ./well-known/ settings.\n#\nwebfinger:\n \n ## jwks ##\n #\n # Configures the /.well-known/jwks.json endpoint.\n #\n jwks:\n \n ## broadcast_keys ##\n #\n # A list of JSON Web Keys that should be exposed at that endpoint. This is usually the public key for verifying OpenID Connect ID Tokens. However, you might want to add additional keys here as well.\n #\n # Default value: hydra.openid.id-token\n #\n # Examples:\n # - hydra.jwt.access-token\n # \n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export WEBFINGER_JWKS_BROADCAST_KEYS=<value>\n # - Windows Command Line (CMD):\n # > set WEBFINGER_JWKS_BROADCAST_KEYS=<value>\n #\n broadcast_keys: hydra.jwt.access-token\n\n ## oidc_discovery ##\n #\n # Configures OpenID Connect Discovery (/.well-known/openid-configuration).\n #\n oidc_discovery:\n \n ## client_registration_url ##\n #\n # Examples:\n # - https://my-service.com/clients\n # \n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export WEBFINGER_OIDC_DISCOVERY_CLIENT_REGISTRATION_URL=<value>\n # - Windows Command Line (CMD):\n # > set WEBFINGER_OIDC_DISCOVERY_CLIENT_REGISTRATION_URL=<value>\n #\n client_registration_url: https://my-service.com/clients\n\n ## supported_claims ##\n #\n # A list of supported claims to be broadcasted. Claim "sub" is always included.\n #\n # Examples:\n # - - email\n # - username\n # \n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export WEBFINGER_OIDC_DISCOVERY_SUPPORTED_CLAIMS=<value>\n # - Windows Command Line (CMD):\n # > set WEBFINGER_OIDC_DISCOVERY_SUPPORTED_CLAIMS=<value>\n #\n supported_claims:\n - email\n - username\n\n ## supported_scope ##\n #\n # The scope OAuth 2.0 Clients may request. Scope `offline`, `offline_access`, and `openid` are always included.\n #\n # Examples:\n # - - email\n # - whatever\n # - read.photos\n # \n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export WEBFINGER_OIDC_DISCOVERY_SUPPORTED_SCOPE=<value>\n # - Windows Command Line (CMD):\n # > set WEBFINGER_OIDC_DISCOVERY_SUPPORTED_SCOPE=<value>\n #\n supported_scope:\n - email\n - whatever\n - read.photos\n\n ## userinfo_url ##\n #\n # A URL of the userinfo endpoint to be advertised at the OpenID Connect Discovery endpoint /.well-known/openid-configuration. Defaults to ORY Hydra\'s userinfo endpoint at /userinfo. Set this value if you want to handle this endpoint yourself.\n #\n # Examples:\n # - https://example.org/my-custom-userinfo-endpoint\n # \n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export WEBFINGER_OIDC_DISCOVERY_USERINFO_URL=<value>\n # - Windows Command Line (CMD):\n # > set WEBFINGER_OIDC_DISCOVERY_USERINFO_URL=<value>\n #\n userinfo_url: https://example.org/my-custom-userinfo-endpoint\n\n## oidc ##\n#\n# Configures OpenID Connect features.\n#\noidc:\n \n ## subject_identifiers ##\n #\n # Configures the Subject Identifier algorithm. For more information please head over to the documentation: https://www.ory.sh/docs/hydra/advanced#subject-identifier-algorithms\n #\n # Examples:\n # - enabled:\n # - public\n # - pairwise\n # pairwise:\n # salt: some-random-salt\n # \n subject_identifiers:\n \n ## enabled ##\n #\n # A list of algorithms to enable.\n #\n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export OIDC_SUBJECT_IDENTIFIERS_ENABLED=<value>\n # - Windows Command Line (CMD):\n # > set OIDC_SUBJECT_IDENTIFIERS_ENABLED=<value>\n #\n enabled:\n - public\n - pairwise\n\n ## pairwise ##\n #\n # Configures the pairwise algorithm.\n #\n pairwise:\n \n ## salt ##\n #\n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export OIDC_SUBJECT_IDENTIFIERS_PAIRWISE_SALT=<value>\n # - Windows Command Line (CMD):\n # > set OIDC_SUBJECT_IDENTIFIERS_PAIRWISE_SALT=<value>\n #\n salt: some-random-salt\n\n ## dynamic_client_registration ##\n #\n # Configures OpenID Connect Dynamic Client Registration (exposed as admin endpoints /clients/...).\n #\n dynamic_client_registration:\n \n ## default_scope ##\n #\n # The OpenID Connect Dynamic Client Registration specification has no concept of whitelisting OAuth 2.0 Scope. If you want to expose Dynamic Client Registration, you should set the default scope enabled for newly registered clients. Keep in mind that users can overwrite this default by setting the "scope" key in the registration payload, effectively disabling the concept of whitelisted scopes.\n #\n # Examples:\n # - - openid\n # - offline\n # - offline_access\n # \n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export OIDC_DYNAMIC_CLIENT_REGISTRATION_DEFAULT_SCOPE=<value>\n # - Windows Command Line (CMD):\n # > set OIDC_DYNAMIC_CLIENT_REGISTRATION_DEFAULT_SCOPE=<value>\n #\n default_scope:\n - openid\n - offline\n - offline_access\n\n## urls ##\n#\nurls:\n \n ## self ##\n #\n self:\n \n ## issuer ##\n #\n # This value will be used as the "issuer" in access and ID tokens. It must be specified and using HTTPS protocol, unless --dangerous-force-http is set. This should typically be equal to the public value.\n #\n # Examples:\n # - https://localhost:4444/\n # \n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export URLS_SELF_ISSUER=<value>\n # - Windows Command Line (CMD):\n # > set URLS_SELF_ISSUER=<value>\n #\n issuer: https://localhost:4444/\n\n ## public ##\n #\n # This is the base location of the public endpoints of your ORY Hydra installation. This should typically be equal to the issuer value. If left unspecified, it falls back to the issuer value.\n #\n # Examples:\n # - https://localhost:4444/\n # \n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export URLS_SELF_PUBLIC=<value>\n # - Windows Command Line (CMD):\n # > set URLS_SELF_PUBLIC=<value>\n #\n public: https://localhost:4444/\n\n ## login ##\n #\n # Sets the login endpoint of the User Login & Consent flow. Defaults to an internal fallback URL.\n #\n # Examples:\n # - https://my-login.app/login\n # \n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export URLS_LOGIN=<value>\n # - Windows Command Line (CMD):\n # > set URLS_LOGIN=<value>\n #\n login: https://my-login.app/login\n\n ## consent ##\n #\n # Sets the consent endpoint of the User Login & Consent flow. Defaults to an internal fallback URL.\n #\n # Examples:\n # - https://my-consent.app/consent\n # \n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export URLS_CONSENT=<value>\n # - Windows Command Line (CMD):\n # > set URLS_CONSENT=<value>\n #\n consent: https://my-consent.app/consent\n\n ## logout ##\n #\n # Sets the logout endpoint. Defaults to an internal fallback URL.\n #\n # Examples:\n # - https://my-logout.app/logout\n # \n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export URLS_LOGOUT=<value>\n # - Windows Command Line (CMD):\n # > set URLS_LOGOUT=<value>\n #\n logout: https://my-logout.app/logout\n\n ## error ##\n #\n # Sets the error endpoint. The error ui will be shown when an OAuth2 error occurs that which can not be sent back to the client. Defaults to an internal fallback URL.\n #\n # Examples:\n # - https://my-error.app/error\n # \n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export URLS_ERROR=<value>\n # - Windows Command Line (CMD):\n # > set URLS_ERROR=<value>\n #\n error: https://my-error.app/error\n\n ## post_logout_redirect ##\n #\n # When a user agent requests to logout, it will be redirected to this url afterwards per default.\n #\n # Examples:\n # - https://my-example.app/logout-successful\n # \n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export URLS_POST_LOGOUT_REDIRECT=<value>\n # - Windows Command Line (CMD):\n # > set URLS_POST_LOGOUT_REDIRECT=<value>\n #\n post_logout_redirect: https://my-example.app/logout-successful\n\n## strategies ##\n#\nstrategies:\n \n ## scope ##\n #\n # Defines how scopes are matched. For more details have a look at https://github.com/ory/fosite#scopes\n #\n # Default value: wildcard\n #\n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export STRATEGIES_SCOPE=<value>\n # - Windows Command Line (CMD):\n # > set STRATEGIES_SCOPE=<value>\n #\n scope: DEPRECATED_HIERARCHICAL_SCOPE_STRATEGY\n\n## ttl ##\n#\n# Configures time to live.\n#\nttl:\n \n ## login_consent_request ##\n #\n # Configures how long a user login and consent flow may take.\n #\n # Default value: 1h\n #\n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export TTL_LOGIN_CONSENT_REQUEST=<value>\n # - Windows Command Line (CMD):\n # > set TTL_LOGIN_CONSENT_REQUEST=<value>\n #\n login_consent_request: 1h\n\n ## access_token ##\n #\n # Configures how long access tokens are valid.\n #\n # Default value: 1h\n #\n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export TTL_ACCESS_TOKEN=<value>\n # - Windows Command Line (CMD):\n # > set TTL_ACCESS_TOKEN=<value>\n #\n access_token: 1h\n\n ## refresh_token ##\n #\n # Configures how long refresh tokens are valid. Set to -1 for refresh tokens to never expire.\n #\n # Default value: 720h\n #\n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export TTL_REFRESH_TOKEN=<value>\n # - Windows Command Line (CMD):\n # > set TTL_REFRESH_TOKEN=<value>\n #\n refresh_token: "-1"\n\n ## id_token ##\n #\n # Configures how long id tokens are valid.\n #\n # Default value: 1h\n #\n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export TTL_ID_TOKEN=<value>\n # - Windows Command Line (CMD):\n # > set TTL_ID_TOKEN=<value>\n #\n id_token: 1h\n\n ## auth_code ##\n #\n # Configures how long auth codes are valid.\n #\n # Default value: 10m\n #\n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export TTL_AUTH_CODE=<value>\n # - Windows Command Line (CMD):\n # > set TTL_AUTH_CODE=<value>\n #\n auth_code: 1h\n\n## oauth2 ##\n#\noauth2:\n \n ## expose_internal_errors ##\n #\n # Set this to true if you want to share error debugging information with your OAuth 2.0 clients. Keep in mind that debug information is very valuable when dealing with errors, but might also expose database error codes and similar errors.\n #\n # Default value: false\n #\n # Examples:\n # - true\n # \n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export OAUTH2_EXPOSE_INTERNAL_ERRORS=<value>\n # - Windows Command Line (CMD):\n # > set OAUTH2_EXPOSE_INTERNAL_ERRORS=<value>\n #\n expose_internal_errors: true\n\n ## hashers ##\n #\n # Configures hashing algorithms. Supports only BCrypt at the moment.\n #\n hashers:\n \n ## bcrypt ##\n #\n # Configures the BCrypt hashing algorithm used for hashing Client Secrets.\n #\n bcrypt:\n \n ## cost ##\n #\n # Sets the BCrypt cost. The higher the value, the more CPU time is being used to generate hashes.\n #\n # Default value: 10\n #\n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export OAUTH2_HASHERS_BCRYPT_COST=<value>\n # - Windows Command Line (CMD):\n # > set OAUTH2_HASHERS_BCRYPT_COST=<value>\n #\n cost: 39871948\n\n ## pkce ##\n #\n pkce:\n \n ## enforced ##\n #\n # Sets whether PKCE should be enforced for all clients.\n #\n # Examples:\n # - true\n # \n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export OAUTH2_PKCE_ENFORCED=<value>\n # - Windows Command Line (CMD):\n # > set OAUTH2_PKCE_ENFORCED=<value>\n #\n enforced: true\n\n## secrets ##\n#\n# The secrets section configures secrets used for encryption and signing of several systems. All secrets can be rotated, for more information on this topic go to: https://www.ory.sh/docs/hydra/advanced#rotation-of-hmac-token-signing-and-database-and-cookie-encryption-keys\n#\nsecrets:\n \n ## system ##\n #\n # The system secret must be at least 16 characters long. If none is provided, one will be generated. They key is used to encrypt sensitive data using AES-GCM (256 bit) and validate HMAC signatures. The first item in the list is used for signing and encryption. The whole list is used for verifying signatures and decryption.\n #\n # Examples:\n # - - this-is-the-primary-secret\n # - this-is-an-old-secret\n # - this-is-another-old-secret\n # \n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export SECRETS_SYSTEM=<value>\n # - Windows Command Line (CMD):\n # > set SECRETS_SYSTEM=<value>\n #\n system:\n - this-is-the-primary-secret\n - this-is-an-old-secret\n - this-is-another-old-secret\n\n ## cookie ##\n #\n # A secret that is used to encrypt cookie sessions. Defaults to secrets.system. It is recommended to use a separate secret in production. The first item in the list is used for signing and encryption. The whole list is used for verifying signatures and decryption.\n #\n # Examples:\n # - - this-is-the-primary-secret\n # - this-is-an-old-secret\n # - this-is-another-old-secret\n # \n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export SECRETS_COOKIE=<value>\n # - Windows Command Line (CMD):\n # > set SECRETS_COOKIE=<value>\n #\n cookie:\n - this-is-the-primary-secret\n - this-is-an-old-secret\n - this-is-another-old-secret\n\n## profiling ##\n#\n# Enables profiling if set. For more details on profiling, head over to: https://blog.golang.org/profiling-go-programs\n#\n# Examples:\n# - cpu\n# \n# Set this value using environment variables on\n# - Linux/macOS:\n# $ export PROFILING=<value>\n# - Windows Command Line (CMD):\n# > set PROFILING=<value>\n#\nprofiling: cpu\n\n## tracing ##\n#\n# ORY Hydra supports distributed tracing.\n#\ntracing:\n \n ## provider ##\n #\n # Set this to the tracing backend you wish to use. Currently supports jaeger. If omitted or empty, tracing will be disabled.\n #\n # Examples:\n # - jaeger\n # \n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export TRACING_PROVIDER=<value>\n # - Windows Command Line (CMD):\n # > set TRACING_PROVIDER=<value>\n #\n provider: jaeger\n\n ## service_name ##\n #\n # Specifies the service name to use on the tracer.\n #\n # Examples:\n # - ORY Hydra\n # \n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export TRACING_SERVICE_NAME=<value>\n # - Windows Command Line (CMD):\n # > set TRACING_SERVICE_NAME=<value>\n #\n service_name: ORY Hydra\n\n ## providers ##\n #\n providers:\n \n ## jaeger ##\n #\n # Configures the jaeger tracing backend.\n #\n jaeger:\n \n ## local_agent_address ##\n #\n # The address of the jaeger-agent where spans should be sent to.\n #\n # Examples:\n # - 127.0.0.1:6831\n # \n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export TRACING_PROVIDERS_JAEGER_LOCAL_AGENT_ADDRESS=<value>\n # - Windows Command Line (CMD):\n # > set TRACING_PROVIDERS_JAEGER_LOCAL_AGENT_ADDRESS=<value>\n #\n local_agent_address: 127.0.0.1:6831\n\n ## propagation ##\n #\n # The tracing header format\n #\n # Examples:\n # - jaeger\n # \n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export TRACING_PROVIDERS_JAEGER_PROPAGATION=<value>\n # - Windows Command Line (CMD):\n # > set TRACING_PROVIDERS_JAEGER_PROPAGATION=<value>\n #\n propagation: jaeger\n\n ## sampling ##\n #\n # Examples:\n # - type: const\n # value: 1\n # server_url: http://localhost:5778/sampling\n # \n sampling:\n \n ## type ##\n #\n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export TRACING_PROVIDERS_JAEGER_SAMPLING_TYPE=<value>\n # - Windows Command Line (CMD):\n # > set TRACING_PROVIDERS_JAEGER_SAMPLING_TYPE=<value>\n #\n type: const\n\n ## value ##\n #\n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export TRACING_PROVIDERS_JAEGER_SAMPLING_VALUE=<value>\n # - Windows Command Line (CMD):\n # > set TRACING_PROVIDERS_JAEGER_SAMPLING_VALUE=<value>\n #\n value: 1\n\n ## server_url ##\n #\n # Set this value using environment variables on\n # - Linux/macOS:\n # $ export TRACING_PROVIDERS_JAEGER_SAMPLING_SERVER_URL=<value>\n # - Windows Command Line (CMD):\n # > set TRACING_PROVIDERS_JAEGER_SAMPLING_SERVER_URL=<value>\n #\n server_url: http://localhost:5778/sampling\n\n')))}c.isMDXComponent=!0},572:function(n,e,t){"use strict";t.d(e,"a",(function(){return d})),t.d(e,"b",(function(){return p}));var a=t(0),o=t.n(a);function i(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function s(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),t.push.apply(t,a)}return t}function r(n){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?s(Object(t),!0).forEach((function(e){i(n,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):s(Object(t)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e))}))}return n}function l(n,e){if(null==n)return{};var t,a,o=function(n,e){if(null==n)return{};var t,a,o={},i=Object.keys(n);for(a=0;a<i.length;a++)t=i[a],e.indexOf(t)>=0||(o[t]=n[t]);return o}(n,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);for(a=0;a<i.length;a++)t=i[a],e.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(n,t)&&(o[t]=n[t])}return o}var u=o.a.createContext({}),c=function(n){var e=o.a.useContext(u),t=e;return n&&(t="function"==typeof n?n(e):r(r({},e),n)),t},d=function(n){var e=c(n.components);return o.a.createElement(u.Provider,{value:e},n.children)},m={inlineCode:"code",wrapper:function(n){var e=n.children;return o.a.createElement(o.a.Fragment,{},e)}},_=o.a.forwardRef((function(n,e){var t=n.components,a=n.mdxType,i=n.originalType,s=n.parentName,u=l(n,["components","mdxType","originalType","parentName"]),d=c(t),_=a,p=d["".concat(s,".").concat(_)]||d[_]||m[_]||i;return t?o.a.createElement(p,r(r({ref:e},u),{},{components:t})):o.a.createElement(p,r({ref:e},u))}));function p(n,e){var t=arguments,a=e&&e.mdxType;if("string"==typeof n||a){var i=t.length,s=new Array(i);s[0]=_;var r={};for(var l in e)hasOwnProperty.call(e,l)&&(r[l]=e[l]);r.originalType=n,r.mdxType="string"==typeof n?n:a,s[1]=r;for(var u=2;u<i;u++)s[u]=t[u];return o.a.createElement.apply(null,s)}return o.a.createElement.apply(null,t)}_.displayName="MDXCreateElement"}}]);
|
describe("$.delegate", function() {
helpers.fixture("events.html");
describe("$.delegate in subject-type-selector-callback form", function() {
it("adds events to the children of the subject", function(done) {
var subject = document.querySelector("#divContainer");
var inner = subject.querySelector("a");
$.delegate(subject, "click", "a", function() {
done();
});
helpers.click(inner);
});
it("can be called on elements", function(done) {
var subject = document.querySelector("#divContainer");
var inner = subject.querySelector("a");
subject._.delegate("click", "a", function() {
done();
});
helpers.click(inner);
});
it("can be called on arrays", function() {
var subjects = Array.from(document.querySelectorAll(".array"));
var inners = Array.from(document.querySelectorAll(".array a"));
var callbackSpy = sinon.spy(function() {
var expectedSubject = subjects[callbackSpy.callCount - 1];
expect(this).to.equal(expectedSubject);
});
subjects._.delegate("click", "a", callbackSpy);
subjects.forEach(helpers.click); // shouldn't trigger callbacks
inners.forEach(helpers.click); // should trigger callbacks
expect(callbackSpy.calledThrice).to.be.ok;
});
});
describe("$.delegate in subject-type-selectorsToCallbacks form", function() {
it("adds events to the children of the subject", function() {
var subject = document.querySelector("#divContainer");
var inners = Array.from(subject.children);
var spy = sinon.spy(function(i, target) {
expect(i).to.equal(spy.callCount);
expect(target).to.equal(subject);
});
$.delegate(subject, "click", {
"a": function() {
spy(1, this);
},
"span": function() {
spy(2, this);
},
"img": function() {
spy(3, this);
}
});
inners.forEach(helpers.click);
expect(spy.calledThrice).to.be.ok;
});
it("can be called on elements", function() {
var subject = document.querySelector("#divContainer");
var inners = Array.from(subject.children);
var spy = sinon.spy(function(i, target) {
expect(i).to.equal(spy.callCount);
expect(target).to.equal(subject);
});
subject._.delegate("click", {
"a": function() {
spy(1, this);
},
"span": function() {
spy(2, this);
},
"img": function() {
spy(3, this);
}
});
inners.forEach(helpers.click);
expect(spy.calledThrice).to.be.ok;
});
it("can be called on arrays", function() {
var subject = document.querySelector("#divContainer");
var inners = Array.from(subject.children);
var spy = sinon.spy(function(i, target) {
expect(i).to.equal(spy.callCount);
expect(target).to.equal(subject);
});
// TODO: Make less trivial (multiple subjects)
[subject]._.delegate("click", {
"a": function() {
spy(1, this);
},
"span": function() {
spy(2, this);
},
"img": function() {
spy(3, this);
}
});
inners.forEach(helpers.click);
expect(spy.calledThrice).to.be.ok;
});
});
describe("$.delegate in subject-typesToSelectorsToCallbacks form", function() {
it("adds events to the children of the subject", function() {
var subject = document.querySelector("#divContainer");
var inners = Array.from(subject.children);
var mouseDownSpy = sinon.spy(function(i, target) {
expect(i).to.equal(mouseDownSpy.callCount);
expect(target).to.equal(subject);
});
var mouseUpSpy = sinon.spy(function(i, target) {
expect(i).to.equal(mouseUpSpy.callCount);
expect(target).to.equal(subject);
});
$.delegate(subject, {
"mousedown": {
"a": function() {
mouseDownSpy(1, this);
},
"span": function() {
mouseDownSpy(2, this);
},
"img": function() {
mouseDownSpy(3, this);
}
},
"mouseup": {
"a": function() {
mouseUpSpy(1, this);
},
"span": function() {
mouseUpSpy(2, this);
},
"img": function() {
mouseUpSpy(3, this);
}
}
});
inners.forEach(helpers.mouseDown);
expect(mouseDownSpy.calledThrice).to.be.ok;
inners.forEach(helpers.mouseUp);
expect(mouseUpSpy.calledThrice).to.be.ok;
});
});
});
|
import { fixture, html } from '@open-wc/testing';
import 'axe-core/axe.min.js';
import { axeReport } from 'pwa-helpers/axe-report.js';
import '@furo/fbp/src/testhelper/test-bind.js'; // for testing with wires and hooks
// eslint-disable-next-line import/no-extraneous-dependencies
import '@furo/testhelper/initEnv.js';
import '../src/display-furo-type-date.js';
import { Env } from '@furo/framework';
describe('display-furo-type-date', () => {
let host;
let display;
let dao;
beforeEach(async () => {
const testbind = await fixture(html`
<test-bind>
<template>
<display-furo-type-date ƒ-bind-data="--dao(*.furo_type_date)"></display-furo-type-date>
<furo-data-object type="experiment.Experiment" @-object-ready="--dao"></furo-data-object>
</template>
</test-bind>
`);
await testbind.updateComplete;
host = testbind._host;
[, display, dao] = testbind.parentNode.children;
await host.updateComplete;
await display.updateComplete;
await dao.updateComplete;
});
it('should be a display-furo-type-date element', done => {
// keep this test on top, so you can recognize a wrong assignment
assert.equal(display.nodeName.toLowerCase(), 'display-furo-type-date');
done();
});
it('should bind data', done => {
setTimeout(() => {
assert.equal(display._field.year._value, null);
assert.equal(display._field.month._value, null);
assert.equal(display._field.day._value, null);
assert.equal(display._displayValue, '');
done();
}, 0);
});
it('should show date according to the value of the data', done => {
Env.locale = 'de';
dao.injectRaw({ furo_type_date: { year: '2000', day: '12', month: '11' } });
setTimeout(() => {
assert.equal(display._displayValue, '12.11.2000');
done();
}, 110);
});
it('should show display_name when it exists ', done => {
Env.locale = 'de';
dao.injectRaw({
furo_type_date: { year: '2000', day: '12', month: '11', display_name: '10.10.2000' },
});
setTimeout(() => {
assert.equal(display._displayValue, '10.10.2000');
done();
}, 110);
});
// axeReport a11y tests
xit('a11y', () => axeReport(display));
});
|
!function(e){function r(r){for(var n,a,i=r[0],c=r[1],l=r[2],s=0,p=[];s<i.length;s++)a=i[s],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&p.push(o[a][0]),o[a]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(r);p.length;)p.shift()();return u.push.apply(u,l||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++){var c=t[i];0!==o[c]&&(n=!1)}n&&(u.splice(r--,1),e=a(a.s=t[0]))}return e}var n={},o={1:0},u=[];function a(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,a),t.l=!0,t.exports}a.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var u,i=document.createElement("script");i.charset="utf-8",i.timeout=120,a.nc&&i.setAttribute("nonce",a.nc),i.src=function(e){return a.p+"static/js/"+({}[e]||e)+"."+{3:"8f35f981"}[e]+".chunk.js"}(e);var c=new Error;u=function(r){i.onerror=i.onload=null,clearTimeout(l);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,t[1](c)}o[e]=void 0}};var l=setTimeout((function(){u({type:"timeout",target:i})}),12e4);i.onerror=i.onload=u,document.head.appendChild(i)}return Promise.all(r)},a.m=e,a.c=n,a.d=function(e,r,t){a.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},a.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,r){if(1&r&&(e=a(e)),8&r)return e;if(4&r&&"object"===typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(a.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)a.d(t,n,function(r){return e[r]}.bind(null,n));return t},a.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(r,"a",r),r},a.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},a.p="/",a.oe=function(e){throw console.error(e),e};var i=this.webpackJsonpleaderboards=this.webpackJsonpleaderboards||[],c=i.push.bind(i);i.push=r,i=i.slice();for(var l=0;l<i.length;l++)r(i[l]);var f=c;t()}([]);
//# sourceMappingURL=runtime-main.73987652.js.map
|
import { JSONAPIFormatter } from '../../src/formatters';
import { parse, stringify } from '../../src';
describe('JSONAPIFormatter.parse', () => {
it('can parse an JSONAPI query', () => {
expect(
parse('?foo[bar]=qux&qux=quux', { formatter: JSONAPIFormatter }),
).toEqual({ foo: { bar: ['qux'] }, qux: 'quux' });
});
it('can parse array value', () => {
expect(
parse('?foo[bar]=qux,quux', { formatter: JSONAPIFormatter }),
).toEqual({ foo: { bar: ['qux', 'quux'] } });
});
it('can parse multiple arrays', () => {
expect(
parse('?foo[bar]=qux,quux&bar[foo]=quux,qux', {
formatter: JSONAPIFormatter,
}),
).toEqual({ foo: { bar: ['qux', 'quux'] }, bar: { foo: ['quux', 'qux'] } });
});
it('can parse multiple values with same key', () => {
expect(
parse('?foo[bar]=qux,quux&foo[qux]=quux', {
formatter: JSONAPIFormatter,
}),
).toEqual({ foo: { bar: ['qux', 'quux'], qux: ['quux'] } });
});
it('can parse weird keys', () => {
expect(
parse('?foo[bar=qux', {
formatter: JSONAPIFormatter,
}),
).toEqual({ 'foo[bar': 'qux' });
expect(
parse('?foobar]=qux', {
formatter: JSONAPIFormatter,
}),
).toEqual({ 'foobar]': 'qux' });
expect(
parse('?foo[bar]a=qux', {
formatter: JSONAPIFormatter,
}),
).toEqual({ 'foo[bar]a': 'qux' });
expect(
parse('?fo[o[bar]=qux', {
formatter: JSONAPIFormatter,
}),
).toEqual({ fo: { 'o[bar': ['qux'] } });
expect(
parse('?foo[[ba]r]=qux', {
formatter: JSONAPIFormatter,
}),
).toEqual({ foo: { '[ba]r': ['qux'] } });
expect(
parse('?foo[[ba]]r]=qux', {
formatter: JSONAPIFormatter,
}),
).toEqual({ foo: { '[ba]]r': ['qux'] } });
expect(
parse('?[foo]=bar,qux', {
formatter: JSONAPIFormatter,
}),
).toEqual({ '': { foo: ['bar', 'qux'] } });
});
it('can parse an empty value', () => {
expect(
parse('?foo[bar]', {
formatter: JSONAPIFormatter,
}),
).toEqual({ foo: { bar: null } });
expect(
parse('?foo[bar]&bar[foo]', {
formatter: JSONAPIFormatter,
}),
).toEqual({ foo: { bar: null }, bar: { foo: null } });
});
it('can disable encoding', () => {
expect(
parse('?foo[bar]=b%C3%A5z%20', {
formatter: JSONAPIFormatter,
decode: false,
}),
).toEqual({ foo: { bar: ['b%C3%A5z%20'] } });
expect(
parse('?foo=b%C3%A5z%20', {
formatter: JSONAPIFormatter,
decode: false,
}),
).toEqual({ foo: 'b%C3%A5z%20' });
});
});
describe('JSONAPIFormatter.stringify', () => {
it('can stringify to an JSONAPI query', () => {
expect(
stringify({ foo: { bar: ['qux'] } }, { formatter: JSONAPIFormatter }),
).toEqual('foo[bar]=qux');
});
it('can stringify non array values', () => {
expect(
stringify({ foo: { bar: 'qux' } }, { formatter: JSONAPIFormatter }),
).toEqual('foo[bar]=qux');
});
it('can stringify multiple keys', () => {
expect(
stringify(
{ foo: { bar: ['qux'], qux: ['baz'] } },
{ formatter: JSONAPIFormatter },
),
).toEqual('foo[bar]=qux&foo[qux]=baz');
});
it('can stringify single array value', () => {
expect(
stringify(
{ foo: { bar: ['qux', 'baz'] } },
{ formatter: JSONAPIFormatter },
),
).toEqual('foo[bar]=qux,baz');
});
it('can stringify multiple array values', () => {
expect(
stringify(
{ foo: { bar: ['qux', 'quux'], qux: ['baz', 'bar'] } },
{ formatter: JSONAPIFormatter },
),
).toEqual('foo[bar]=qux,quux&foo[qux]=baz,bar');
});
it('can stringify non nested array', () => {
expect(
stringify({ foo: ['qux', 'baz'] }, { formatter: JSONAPIFormatter }),
).toEqual('foo=qux,baz');
});
it('can stringify a plain value', () => {
expect(
stringify({ foo: 'bar', baz: 'qux' }, { formatter: JSONAPIFormatter }),
).toEqual('foo=bar&baz=qux');
});
it('can stringify a null value', () => {
expect(stringify({ foo: null }, { formatter: JSONAPIFormatter })).toEqual(
'foo',
);
});
it('can URI encode keys and values', () => {
expect(
stringify(
{ 'foo bar': { bar: ["q'ux", 'baz'] } },
{ formatter: JSONAPIFormatter },
),
).toEqual('foo%20bar[bar]=q%27ux,baz');
expect(stringify({ foo: 'b ar' }, { formatter: JSONAPIFormatter })).toEqual(
'foo=b%20ar',
);
});
it('can disable URI encoding', () => {
expect(
stringify(
{ 'f oo': 'bar' },
{ formatter: JSONAPIFormatter, encode: false },
),
).toEqual('f oo=bar');
expect(
stringify(
{ 'foo bar': { bar: ["q'ux", 'baz'] } },
{ formatter: JSONAPIFormatter, encode: false },
),
).toEqual("foo bar[bar]=q'ux,baz");
expect(
stringify(
{ foo: { bar: 'q ux' } },
{ formatter: JSONAPIFormatter, encode: false },
),
).toEqual('foo[bar]=q ux');
});
});
|
import React, {PropTypes} from 'react';
import { connect } from 'react-redux';
import CaseStudy from 'components/case-study';
import BackBar from 'components/ui/backbar';
import PageLayout from 'layouts/PageLayout/PageLayout';
import has from 'lodash/has';
import snakeCase from 'lodash/snakeCase';
const mapStateToProps = (state) => ({
work: state.work,
viewport: state.viewport
});
export class Direct extends PageLayout {
static propTypes = {
dispatch: PropTypes.func,
work: PropTypes.object,
toggleNav: PropTypes.func,
viewport: PropTypes.viewport
};
static contextTypes = {
router: PropTypes.object
};
constructor (props) {
super(props);
this.state = {
singleMode: false,
activeStudy: null
};
}
goBack () {
TweenLite.to(document.body, 0.5, {autoAlpha: 0, ease: Circ.easeInOut, className: '+=isHidden', onComplete: () => {
this.context.router.push({pathname: '/work'});
}});
}
getCurrentCaseStudy () {
let current = {};
this.props.work.studyData.filter(function (a, b) {
if (snakeCase(a.get('title')) === this.props.params.project) {
current.study = a;
}
}, this);
return current;
}
createCurrentStudy (current) {
return (
<CaseStudy showBody {...this.props} singleMode data={current.study}>
<BackBar showBar singleMode data={current.study.toJS()} goBack={this.goBack.bind(this)} />
</CaseStudy>
);
}
getCurrentStudy () {
const current = this.getCurrentCaseStudy();
if (has(current, 'study')) {
return this.createCurrentStudy(current);
} else {
this.context.router.push({pathname: '/404'});
}
}
componentDidMount () {
this.actions.changeNavState({isVisible: false, shouldAnimate: false});
TweenLite.set('#footer', {autoAlpha: 0});
TweenLite.set(document.documentElement, {overflowY: 'hidden'});
TweenLite.fromTo(this.refs.caseStudy, 1, {autoAlpha: 0}, {autoAlpha: 1, ease: Expo.easeInOut, delay: 1});
}
componentWillUnmount () {
this.actions.changeNavState({isVisible: true});
TweenLite.set('#footer', {autoAlpha: 1});
TweenLite.set(document.documentElement, {clearProps: 'overflow'});
}
hideInactiveProjects (activeStudy, singleMode) {
this.setState({singleMode: singleMode, activeStudy: activeStudy});
}
render () {
return (
<div ref='caseStudy' style={{opacity: 0, position: 'absolute', top: 0, left: 0, width: '100%', height: '100%'}}>
{this.getCurrentStudy()}
</div>
);
}
}
export default connect(mapStateToProps)(Direct);
|
function tm7_plot_3d(containerSelector, plot_data) {
var set1_data = JSON.parse(JSON.stringify(plot_data["coordinates_set1"]));
var set2_data = JSON.parse(JSON.stringify(plot_data["coordinates_set2"]));
set1_data.forEach(function (entry) {
entry.id = entry.label
entry.color = "set1"
});
set2_data.forEach(function (entry) {
entry.id = entry.label
entry.color = "set2"
});
set_colors = [];
set_colors['set1'] = "#99ccff";
set_colors['set2'] = "#ff9999";
// Set colors
set_1_color = "#99ccff";
set_2_color = "#ff9999";
circle_r = 23;
line_widths = 3;
path_r = circle_r + 3 + line_widths;
line_distance_from_center = path_r;
values_font_size = 16;
values_font_size_hiding = 6;
tm_font_size = 8;
minimum_angle_to_show = 10;
minimum_distance_to_show = 1;
padding = 53; //33
min_y = Math.min.apply(Math, [...set1_data, ...set2_data].map(a => a.y)) - padding;
max_y = Math.max.apply(Math, [...set1_data, ...set2_data].map(a => a.y)) + padding;
min_x = Math.min.apply(Math, [...set1_data, ...set2_data].map(a => a.x)) - padding;
max_x = Math.max.apply(Math, [...set1_data, ...set2_data].map(a => a.x)) + padding;
$(containerSelector).html('')
$(containerSelector).addClass("tm7Plot");
$(containerSelector).css("position","relative");
var svgContainer = d3v4.select(containerSelector).append("svg")
// .attr("viewBox", min_x + " " + min_y + " " + (max_x - min_x) + " " + (max_y - min_y))
.attr("viewBox", 0 + " " + 0 + " " + 600 + " " + 600)
.attr("width", "100%")
.attr("style", "height: 500px");
var defs = svgContainer.append("defs");
defs.append("marker")
.attr("id", "arrowhead")
.attr("refX", 2) /*must be smarter way to calculate shift*/
.attr("refY", 2)
.attr("markerWidth", 6)
.attr("markerHeight", 4)
.attr("viewBox", "0 0 10 10")
.attr("orient", "auto")
.append("path")
.attr("d", "M 2,0 V 4 L6,2 Z")
.attr("fill", "grey");
defs.append("marker")
.attr("id", "arrowhead-rev")
.attr("refX", 5)
.attr("refY", 5)
.attr("markerWidth", 2)
.attr("markerHeight", 2)
.attr("viewBox", "0 0 10 10")
.attr("orient", "auto-start-reverse")
.append("path")
.attr("d", "M 0 0 L 10 5 L 0 10 z")
.attr("fill", "grey");
//Filter for the outside glow
var filter = defs.append("filter")
.attr("id","glow");
filter.append("feGaussianBlur")
.attr("stdDeviation","1.5")
.attr("result","coloredBlur");
var feMerge = filter.append("feMerge");
feMerge.append("feMergeNode")
.attr("in","coloredBlur");
feMerge.append("feMergeNode")
.attr("in", "SourceGraphic");
var filter2 = defs.append("filter")
.attr("id", "shadow")
.append("feDropShadow")
.attr("dx", 0.2)
.attr("dy", 1)
.attr("stdDeviation",0.2);
var filter3 = defs.append('filter').attr('id', 'lightMe');
filter3.append('feDiffuseLighting')
.attr('in', 'SourceGraphic')
.attr('result', 'light')
.attr('lighting-color', 'white')
.append('fePointLight')
.attr('x', 0.85 * 35)
.attr('y', 0.85 * 35)
.attr('z', 50);
filter3.append('feComposite')
.attr('in', 'SourceGraphic')
.attr('in2', 'light')
.attr('operator', 'arithmetic')
.attr('k1', '1')
.attr('k2', '0')
.attr('k3', '0')
.attr('k4', '0');
var origin = [250, 250],
j = 10,
scale = 10,
scatter = [],
yLine = [],
xGrid = [],
beta = 0,
alpha = 0,
key = function(d){ return d.id; },
startAngle = 0;
var svgContainer = svgContainer.call(d3v4.drag().on('drag', dragged).on('start', dragStart).on('end', dragEnd)).append('g');
var color = d3v4.scaleOrdinal(d3v4.schemeCategory10);
var mx, my, mouseX, mouseY;
var grid3d = d3v4._3d()
.shape('GRID', 20)
.origin(origin)
.rotateY( startAngle)
.rotateX(-startAngle)
.scale(scale);
var point3d = d3v4._3d()
.x(function(d){ return d.x; })
.y(function(d){ return d.y; })
.z(function(d){ return d.z; })
.origin(origin)
.rotateY( startAngle)
.rotateX(-startAngle)
.scale(scale);
var yScale3d = d3v4._3d()
.shape('LINE_STRIP')
.origin(origin)
.rotateY( startAngle)
.rotateX(-startAngle)
.scale(scale);
var lines;
var latest_data;
var sets;
var g_sets, circles;
function processData(data, tt, initial) {
latest_data = data;
for (var i of Object.keys(set1_data)) {
ii = parseInt(i) + 7;
distance = get_distance(data[1][i], data[1][ii]);
direction = get_vector(data[1][i], data[1][ii]);
cos_direction = direction[0] / direction[1];
rad = Math.atan2(direction[1], direction[0]);
degrees = -rad * (180 / Math.PI);
degrees = degrees ? -degrees : 0;
// scaled_rotation = Math.abs(set2_data[i].rotation) < 20 ? 20 : Math.abs(set2_data[i].rotation);
// from = - scaled_rotation / 2;
// to = scaled_rotation / 2;
// cos1 = parseInt(Math.cos(toRadians(from)) * path_r);
// sin1 = parseInt(Math.sin(toRadians(from)) * path_r);
// cos2 = parseInt(Math.cos(toRadians(to)) * path_r);
// sin2 = parseInt(Math.sin(toRadians(to)) * path_r);
// arc_flag = Math.sign(set2_data[i].rotation) > 0 ? 1 : 0;
// arc_flag = 1;
// arc_path = "M" + cos1 + " " + sin1 + " A "+path_r+" "+path_r+" 1 0 " + arc_flag + " " + cos2 + " " + sin2; //Q-32,-32
set2_data[i].rotate_text = degrees;
set2_data[i].movement = distance;
// set2_data[i].arc_path = arc_path;
distance_sign = -1;
if (degrees < -90 && degrees > -180) distance_sign = 1;
if (degrees > 90 && degrees < 180) distance_sign = 1;
set2_data[i].distance_sign = distance_sign;
set1_data[i].dis_x1 = data[1][i].projected.x + Math.cos(toRadians(degrees + 90*distance_sign)) * line_distance_from_center;
set1_data[i].dis_y1 = data[1][i].projected.y + Math.sin(toRadians(degrees + 90*distance_sign)) * line_distance_from_center;
set1_data[i].dis_x2 = data[1][ii].projected.x + Math.cos(toRadians(degrees + 90*distance_sign)) * line_distance_from_center;
set1_data[i].dis_y2 = data[1][ii].projected.y + Math.sin(toRadians(degrees + 90 * distance_sign)) * line_distance_from_center;
set1_data[i].i = parseInt(i);
set2_data[i].i = parseInt(i)+7;
}
/* ----------- GRID ----------- */
var xGrid = svgContainer.selectAll('path.grid').data(data[0], key);
xGrid
.enter()
.append('path')
.attr('class', '_3d grid')
.merge(xGrid)
.attr('stroke', 'black')
.attr('stroke-width', 0.3)
.attr('fill', function(d){ return d.ccw ? 'lightgrey' : '#eeeeee'; })
.attr('fill-opacity', 0.1)
.attr('d', grid3d.draw);
xGrid.exit().remove();
/* ----------- POINTS ----------- */
if (initial) {
sets = svgContainer.selectAll('test').data(data[1], key);
g_sets = sets
.enter()
.append('g')
.classed("_3d", true)
.classed("tm7", true)
.classed("set1", function (d) { return d.color == "set1"; })
.classed("set2", function (d) { return d.color == "set2"; })
.attr('id', function (d) { return d.label+"_"+d.color })
.attr('opacity', 1)
.attr("transform", function (d) { return "translate(" + d.projected.x + "," + d.projected.y + ")" })
circles = g_sets.append("circle")
.attr("r", 32)
.attr('id', function (d) { return d.label+"_"+d.color })
.attr('opacity', function (d) { return d.color == "set1" ? 1 : 1; })
.attr('fill', function (d) { return set_colors[d.color]; })
.style("stroke-width", "1px")
.attr("stroke", "#555")
.style("stroke-dasharray", function (d,i) { return d.color=="set1" ? 4 : 0; })
.attr('filter', 'url(#lightMe)')
texts = g_sets.append("text")
.attr("class","sets_labels")
.attr("dy", ".35em")
.attr("text-anchor", 'middle')
.text(function (d) { return d.label })
} else {
g_sets.attr("transform", function (d, i) { dd = data[1][i]; return "translate(" + dd.projected.x + "," + dd.projected.y + ")";})
}
/* ----------- distance-lines ----------- */
line_distance_from_center = 35;
if (initial) {
alllines = svgContainer.append("g").selectAll(".distance_line").data(set1_data).enter().append("g");
lines = alllines.append("line")
.attr("class", "distance_line _3d")
.attr("x1", function (d, i) { return d.dis_x1 })
.attr("y1", function (d, i) { return d.dis_y1 })
.attr("x2", function (d, i) { return d.dis_x2 })
.attr("y2", function (d, i) { return d.dis_y2 })
.style("stroke", "grey")
.attr("stroke-width", 3)
;
} else {
lines
.attr("class", "distance_line")
.attr("x1", function (d, i) { return d.dis_x1 })
.attr("y1", function (d, i) { return d.dis_y1 })
.attr("x2", function (d, i) { return d.dis_x2 })
.attr("y2", function (d, i) { return d.dis_y2 })
}
/* ----------- y-Scale ----------- */
// var yScale = svg.selectAll('path.yScale').data(data[2]);
// yScale
// .enter()
// .append('path')
// .attr('class', '_3d yScale')
// .merge(yScale)
// .attr('stroke', 'black')
// .attr('stroke-width', .5)
// .attr('d', yScale3d.draw);
// yScale.exit().remove();
// /* ----------- y-Scale Text ----------- */
// var yText = svg.selectAll('text.yText').data(data[2][0]);
// yText
// .enter()
// .append('text')
// .attr('class', '_3d yText')
// .attr('dx', '.3em')
// .merge(yText)
// .each(function(d){
// d.centroid = {x: d.rotated.x, y: d.rotated.y, z: d.rotated.z};
// })
// .attr('x', function(d){ return d.projected.x; })
// .attr('y', function(d){ return d.projected.y; })
// .text(function (d) { return d[2] <= 0 ? d[2] : ''; });
// yText.exit().remove();
svgContainer.selectAll('._3d').sort(d3v4._3d().sort);
}
function posPointX(d){
return d.projected.x;
}
function posPointY(d){
return d.projected.y;
}
function init(){
var cnt = 0;
xGrid = [], scatter = [], yLine = [];
for (var i of Object.keys(set1_data)) {
n = set1_data[i];
// xGrid.push([n.x, 1, n.z]);
scatter.push({x: n.x, y: n.y, z: n.z, id: n.label, color: 'set1'});
}
for(var z = -j; z < j; z++){
for(var x = -j; x < j; x++){
xGrid.push([x, z, -10]);
}
}
d3v4.range(-1, 11, 1).forEach(function(d){ yLine.push([-j, -j, -d]); });
var data = [
grid3d(xGrid),
point3d([...set1_data, ...set2_data]),
yScale3d([yLine])
];
processData(data, 1000, true);
}
function dragStart(){
mx = d3v4.event.x;
my = d3v4.event.y;
}
function dragged(){
mouseX = mouseX || 0;
mouseY = mouseY || 0;
beta = (d3v4.event.x - mx + mouseX) * Math.PI / 230 ;
alpha = (d3v4.event.y - my + mouseY) * Math.PI / 230 * (-1);
var data = [
grid3d.rotateY(beta + startAngle).rotateX(alpha - startAngle)(xGrid),
point3d.rotateY(beta + startAngle).rotateX(alpha - startAngle)([...set1_data, ...set2_data]),
yScale3d.rotateY(beta + startAngle).rotateX(alpha - startAngle)([yLine]),
];
processData(data, 0);
}
function dragEnd(){
mouseX = d3v4.event.x - mx + mouseX;
mouseY = d3v4.event.y - my + mouseY;
}
init();
// animate_movement();
create_overlay();
return true;
// Scaling factor from Å distance to pixel distance..
var scaling_factor = 8;
// Set colors
set_1_color = "#99ccff";
set_2_color = "#ff9999";
// Grab plotting data from call
var set1_data = plot_data["coordinates_set1"]
var set2_data = plot_data["coordinates_set2"]
// Correct first ref2 compared to ref1
/*desired_distance = get_desired_distance(ref[0], ref[1]); //matrix_set1[ref[0]][ref[1]] * scaling_factor;
current_distance = get_distance(set2_data[ref[0]], set2_data[ref[1]]);
move_to_fit_distance(set2_data[ref[0]], set2_data[ref[1]], desired_distance)
// Start moving remaining set2_data compared to ref1 and ref2
for (var key of Object.keys(set2_data)) {
if (ref.includes(parseInt(key))) continue;
distance_1 = get_desired_distance(ref[0], key);
distance_2 = get_desired_distance(ref[1], key);
intersections = intersection(set2_data[ref[0]].x, set2_data[ref[0]].y, distance_1, set2_data[ref[1]].x, set2_data[ref[1]].y, distance_2);
delta_1 = get_distance(set2_data[key], { "x": intersections[0], "y": intersections[2] })
delta_2 = get_distance(set2_data[key], { "x": intersections[1], "y": intersections[3] })
if (delta_1 < delta_2) {
set2_data[key].x = Math.round(intersections[0]);
set2_data[key].y = Math.round(intersections[2]);
} else {
set2_data[key].x = Math.round(intersections[1]);
set2_data[key].y = Math.round(intersections[3]);
}
}
var myJSON = JSON.stringify(set2_data);*/
// Scaling of the coordinates
set1_data.forEach(function (entry) {
entry.x = entry.x*scaling_factor
entry.y = entry.y*scaling_factor
});
set2_data.forEach(function (entry) {
entry.x = entry.x*scaling_factor
entry.y = entry.y*scaling_factor
});
padding = 53; //33
min_y = Math.min.apply(Math, [...set1_data, ...set2_data].map(a => a.y)) - padding;
max_y = Math.max.apply(Math, [...set1_data, ...set2_data].map(a => a.y)) + padding;
min_x = Math.min.apply(Math, [...set1_data, ...set2_data].map(a => a.x)) - padding;
max_x = Math.max.apply(Math, [...set1_data, ...set2_data].map(a => a.x)) + padding;
circle_r = 33;
line_widths = 3;
path_r = circle_r + 3 + line_widths;
line_distance_from_center = path_r;
values_font_size = 16;
values_font_size_hiding = 6;
tm_font_size = 8;
minimum_angle_to_show = 10;
minimum_distance_to_show = 1;
for (var i of Object.keys(set1_data)) {
distance = get_distance(set1_data[i], set2_data[i])/scaling_factor;
direction = get_vector(set1_data[i], set2_data[i]);
cos_direction = direction[0] / direction[1];
rad = Math.atan2(direction[1], direction[0]);
degrees = -rad * (180 / Math.PI);
degrees = degrees ? -degrees : 0;
scaled_rotation = Math.abs(set2_data[i].rotation) < 20 ? 20 : Math.abs(set2_data[i].rotation);
from = - scaled_rotation / 2;
to = scaled_rotation / 2;
cos1 = parseInt(Math.cos(toRadians(from)) * path_r);
sin1 = parseInt(Math.sin(toRadians(from)) * path_r);
cos2 = parseInt(Math.cos(toRadians(to)) * path_r);
sin2 = parseInt(Math.sin(toRadians(to)) * path_r);
arc_flag = Math.sign(set2_data[i].rotation) > 0 ? 1 : 0;
arc_flag = 1;
arc_path = "M" + cos1 + " " + sin1 + " A "+path_r+" "+path_r+" 1 0 " + arc_flag + " " + cos2 + " " + sin2; //Q-32,-32
set2_data[i].rotate_text = degrees;
set2_data[i].movement = distance;
set2_data[i].arc_path = arc_path;
distance_sign = -1;
if (degrees < -90 && degrees > -180) distance_sign = 1;
if (degrees > 90 && degrees < 180) distance_sign = 1;
set2_data[i].distance_sign = distance_sign;
console.log(i,degrees,set2_data[i].rotation)
}
$(containerSelector).html('')
$(containerSelector).addClass("tm7Plot");
$(containerSelector).css("position","relative");
var svgContainer = d3v4.select(containerSelector).append("svg")
.attr("viewBox", min_x + " " + min_y + " " + (max_x - min_x) + " " + (max_y - min_y))
.attr("width", "100%")
.attr("style", "height: 500px");
var animate_run = 0;
var repeat_animate = false;
function animate_movement() {
var delay = 500;
var duration = 2000;
// initial
svgContainer.selectAll(".set2.tm7")
.transition()
.attr("transform", function (d, i) { return "translate(" + latest_data[1][d.i-7].projected.x + "," + latest_data[1][d.i-7].projected.y + ")" })
svgContainer.selectAll(".set2.tm7").attr("opacity", 0.9);
svgContainer.selectAll(".set2.circle").attr("fill", set_1_color);
svgContainer.selectAll(".angles").attr("d", "M 35 0 A 35 35 1 0 1 35 0").attr("opacity", 0)
svgContainer.selectAll(".labelText").attr("font-size",values_font_size_hiding)
svgContainer.selectAll(".angles_text")
.attr("transform", function (d, i) {
var x = set1_data[i].x + Math.cos(toRadians(d.rotate_text)) * (line_distance_from_center + 2);
var y = set1_data[i].y + Math.sin(toRadians(d.rotate_text)) * (line_distance_from_center + 2);
return "translate(" + x + "," + y + ") rotate(" + (d.rotate_text + 90) + ")";
})
.attr("opacity", 0)
.attr("font-size",values_font_size_hiding)
svgContainer.selectAll(".distance_line")
.attr("opacity", 0)
.attr("x2", function (d, i) { return d.dis_x1 })
.attr("y2", function (d, i) { return d.dis_y1 })
svgContainer.selectAll(".distance_text")
.attr("opacity", 0)
.attr("transform", function (d, i) {
var x = (set1_data[i].x) + Math.cos(toRadians(d.rotate_text + 90*d.distance_sign)) * (line_distance_from_center + line_widths*1.5);
var y = (set1_data[i].y) + Math.sin(toRadians(d.rotate_text + 90*d.distance_sign)) * (line_distance_from_center + line_widths*1.5);
text_rotation = d.distance_sign == -1 ? 0 : 180;
return "translate(" + x + "," + y + ") rotate(" + (d.rotate_text + text_rotation) + ")";
})
.attr("font-size",values_font_size_hiding)
svgContainer.selectAll(".set2_labels")
.attr("transform", function (d) { return "rotate(" + (-d.rotate_text) + ")" })
// move out to fully extended
// https://bl.ocks.org/d3noob/1ea51d03775b9650e8dfd03474e202fe
var n = 10002;
var t0 = svgContainer.transition().delay(delay).ease(d3v4.easeExp).duration(duration);
// move circles and rotate
t0.selectAll(".set2.tm7")
.attr("opacity", "0.9")
.attr("transform", function (d, i) { return "translate(" + latest_data[1][d.i].projected.x + "," + latest_data[1][d.i].projected.y + ")" })
t0.selectAll(".set2.circle").attr("fill", set_2_color);
t0.selectAll(".set1.tm7").attr("opacity", "0.2");
// make angle arc
t0.selectAll(".angles")
.attr("opacity", 1)
.attr("d", function (d, i) { return d.arc_path })
t0.selectAll(".labelText")
.tween("text", function (d, ii) {
var i = d3.interpolate(0, Math.abs(d.rotation));
return function (t) {
d3.select(this).text(i(t).toFixed(0) + "°");
};
})
.attr("font-size",values_font_size)
t0.selectAll(".angles_text")
.attr("transform", function (d, i) {
var x = d.x + Math.cos(toRadians(d.rotate_text)) * (line_distance_from_center + 2);
var y = d.y + Math.sin(toRadians(d.rotate_text)) * (line_distance_from_center + 2);
return "translate(" + x + "," + y + ") rotate(" + (d.rotate_text + 90) + ")";
})
.tween("text", function (d, ii) {
var i = d3.interpolate(0, Math.abs(d.rotation));
return function (t) {
d3.select(this).text(i(t).toFixed(0) + "°");
};
})
.attr("opacity", 1)
.attr("font-size",values_font_size)
// make distance lines
t0.selectAll(".distance_line")
.attr("marker-end", "url(#arrowhead)")
.attr("x2", function (d, i) { return d.dis_x2 })
.attr("y2", function (d, i) { return d.dis_y2 })
.attr("opacity", 1)
t0.selectAll(".distance_text")
.attr("opacity", 1)
.attr("transform", function (d, i) {
var x = (d.x + set1_data[i].x) / 2 + Math.cos(toRadians(d.rotate_text + 90*d.distance_sign)) * (line_distance_from_center + line_widths*1.5);
var y = (d.y + set1_data[i].y) / 2 + Math.sin(toRadians(d.rotate_text + 90*d.distance_sign)) * (line_distance_from_center + line_widths*1.5);
text_rotation = d.distance_sign == -1 ? 0 : 180;
return "translate(" + x + "," + y + ") rotate(" + (d.rotate_text + text_rotation) + ")";
})
.tween("text", function (d, ii) {
var i = d3.interpolate(0, d.movement);
return function (t) {
d3.select(this).text(i(t).toFixed(1) + "Å");
};
})
.attr("font-size",values_font_size)
t0.selectAll(".set2_labels")
.attr("transform", function (d) { return "rotate(" + (-d.rotate_text) + ")" })
if (!repeat_animate) return
// move back to initial
var t1 = t0.transition().delay(delay).duration(duration);
// move circles and rotate
t1.selectAll(".set2.tm7")
.attr("transform", function (d, i) { return "translate(" + latest_data[1][d.i-7].projected.x + "," + latest_data[1][d.i-7].projected.y + ")" })
t1.selectAll(".set2.circle").attr("fill", set_1_color);
// make angle arc small again and disapear
t1.selectAll(".angles")
.attr("opacity", 0)
.attr("d", "M 35 0 A 35 35 1 0 1 35 0")
t1.selectAll(".labelText")
.tween("text", function (d, ii) {
var i = d3.interpolate(Math.abs(d.rotation), 0);
return function (t) {
d3.select(this).text(i(t).toFixed(0) + "°");
};
})
.attr("font-size",values_font_size_hiding)
t1.selectAll(".angles_text")
.attr("transform", function (d, i) {
var x = set1_data[i].x + Math.cos(toRadians(d.rotate_text)) * (line_distance_from_center + 2);
var y = set1_data[i].y + Math.sin(toRadians(d.rotate_text)) * (line_distance_from_center + 2);
return "translate(" + x + "," + y + ") rotate(" + (d.rotate_text + 90) + ")";
})
.tween("text", function (d, ii) {
var i = d3.interpolate(Math.abs(d.rotation), 0);
return function (t) {
d3.select(this).text(i(t).toFixed(0) + "°");
};
})
.attr("opacity", 0)
.attr("font-size",values_font_size_hiding)
// make distance lines
t1.selectAll(".distance_line")
.attr("x2", function (d, i) { return d.dis_x1 })
.attr("y2", function (d, i) { return d.dis_y1 })
.attr("opacity", 0)
t1.selectAll(".distance_text")
.attr("transform", function (d, i) {
var x = (set1_data[i].x) + Math.cos(toRadians(d.rotate_text + 90*d.distance_sign)) * (line_distance_from_center + line_widths*1.5);
var y = (set1_data[i].y) + Math.sin(toRadians(d.rotate_text + 90*d.distance_sign)) * (line_distance_from_center + line_widths*1.5);
text_rotation = d.distance_sign == -1 ? 0 : 180;
return "translate(" + x + "," + y + ") rotate(" + (d.rotate_text + text_rotation) + ")";
})
.tween("text", function (d, ii) {
var i = d3.interpolate(d.movement, 0);
return function (t) {
d3.select(this).text(i(t).toFixed(1) + "Å");
};
})
.attr("opacity", 0)
.attr("font-size",values_font_size_hiding)
t1.selectAll(".set2_labels")
.attr("transform", function (d) { return "rotate(" + (-d.rotate_text) + ")" })
// Repeat!
if (repeat_animate) t1.on("end", function (d, i) { return i == 0 ? animate_movement() : '' });
animate_run += 1;
// console.log('animate..',animate_run)
}
function create_overlay() {
var newDiv = document.createElement("div");
$(containerSelector).find(".controls-panel").remove();
newDiv.setAttribute("class", "controls-panel");
content = '<span class="pull-right network_controls_toggle" style="cursor: pointer;"><span class="glyphicon glyphicon-option-horizontal btn-download png"></span></span><span class="options" style="display: block; min-width: 120px;">' +
'Animate <input id="animate" type="checkbox" '+ (repeat_animate ? 'checked' : '') +'><br>' +
'Hide low numbers <input id="hide_low" type="checkbox" checked><br>' +
'</span>';
newDiv.innerHTML = content;
$(containerSelector).prepend(newDiv);
$(containerSelector).find(".options").toggle();
$(containerSelector).find(".network_controls_toggle").click(function() {
$(containerSelector).find(".options").slideToggle();
});
d3v4.select(containerSelector).select("#animate").on("change", function () {
repeat_animate = d3.select(containerSelector).select("#animate").property("checked");
animate_movement();
});
d3.select(containerSelector).select("#hide_low").on("change", function () {
hide_low = d3.select(containerSelector).select("#hide_low").property("checked");
$(containerSelector).find(".low_number").fadeToggle();
});
}
function toRadians(angle) {
return angle * (Math.PI / 180);
}
function get_distance(node1, node2) {
let dx = parseInt(node2.projected.x) - parseInt(node1.projected.x);
let dy = parseInt(node2.projected.y) - parseInt(node1.projected.y);
return Math.sqrt(dx * dx + dy * dy);
}
function get_desired_distance(from, to) {
distance = matrix_set2[from][to];
if (parseInt(distance) == 0) distance = matrix_set2[to][from];
return distance * scaling_factor;
}
function move_to_fit_distance(fixed_node, moving_node, desired_distance) {
current_distance = get_distance(fixed_node, moving_node);
console.log('current_distance', current_distance);
vector = get_vector(fixed_node, moving_node);
console.log('vector', vector);
scaling = (desired_distance / current_distance);
new_vector = vector.map(function (x) { return x * scaling; });
console.log('new_vector', new_vector);
moving_node.x = fixed_node.x + new_vector[0];
moving_node.y = fixed_node.y + new_vector[1];
}
function get_vector(node1, node2) {
return [node2.projected.x - node1.projected.x, node2.projected.y - node1.projected.y];
}
function move_to_fit_refs(ref1, ref2, node) {
intersections = intersection(ref1.x, ref1.y)
}
function intersection(x0, y0, r0, x1, y1, r1) {
var a, dx, dy, d, h, rx, ry;
var x2, y2;
/* dx and dy are the vertical and horizontal distances between
* the circle centers.
*/
dx = x1 - x0;
dy = y1 - y0;
/* Determine the straight-line distance between the centers. */
d = Math.sqrt((dy * dy) + (dx * dx));
/* Check for solvability. */
if (d > (r0 + r1)) {
/* no solution. circles do not intersect. */
return false;
}
if (d < Math.abs(r0 - r1)) {
/* no solution. one circle is contained in the other */
return false;
}
/* 'point 2' is the point where the line through the circle
* intersection points crosses the line between the circle
* centers.
*/
/* Determine the distance from point 0 to point 2. */
a = ((r0 * r0) - (r1 * r1) + (d * d)) / (2.0 * d);
/* Determine the coordinates of point 2. */
x2 = x0 + (dx * a / d);
y2 = y0 + (dy * a / d);
/* Determine the distance from point 2 to either of the
* intersection points.
*/
h = Math.sqrt((r0 * r0) - (a * a));
/* Now determine the offsets of the intersection points from
* point 2.
*/
rx = -dy * (h / d);
ry = dx * (h / d);
/* Determine the absolute intersection points. */
var xi = x2 + rx;
var xi_prime = x2 - rx;
var yi = y2 + ry;
var yi_prime = y2 - ry;
return [xi, xi_prime, yi, yi_prime];
}
}
|
/**
* Cesium - https://github.com/AnalyticalGraphicsInc/cesium
*
* Copyright 2011-2013 Cesium Contributors
*
* 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.
*
* Columbus View (Pat. Pend.)
*
* Portions licensed separately.
* See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details.
*/
(function () {
/*global define*/
define('Core/defined',[],function() {
"use strict";
/**
* Returns true if the object is defined, returns false otherwise.
*
* @exports defined
*
* @example
* if (defined(positions)) {
* doSomething();
* } else {
* doSomethingElse();
* }
*/
var defined = function(value) {
return value !== undefined;
};
return defined;
});
/*global define*/
define('Core/DeveloperError',['./defined'], function(defined) {
"use strict";
/**
* Constructs an exception object that is thrown due to a developer error, e.g., invalid argument,
* argument out of range, etc. This exception should only be thrown during development;
* it usually indicates a bug in the calling code. This exception should never be
* caught; instead the calling code should strive not to generate it.
* <br /><br />
* On the other hand, a {@link RuntimeError} indicates an exception that may
* be thrown at runtime, e.g., out of memory, that the calling code should be prepared
* to catch.
*
* @alias DeveloperError
*
* @param {String} [message=undefined] The error message for this exception.
*
* @see RuntimeError
* @constructor
*/
var DeveloperError = function(message) {
/**
* 'DeveloperError' indicating that this exception was thrown due to a developer error.
* @type {String}
* @constant
*/
this.name = 'DeveloperError';
/**
* The explanation for why this exception was thrown.
* @type {String}
* @constant
*/
this.message = message;
var e = new Error();
/**
* The stack trace of this exception, if available.
* @type {String}
* @constant
*/
this.stack = e.stack;
};
DeveloperError.prototype.toString = function() {
var str = this.name + ': ' + this.message;
if (defined(this.stack)) {
str += '\n' + this.stack.toString();
}
return str;
};
return DeveloperError;
});
/*global define*/
define('Core/freezeObject',['./defined'], function(defined) {
"use strict";
/**
* Freezes an object, using Object.freeze if available, otherwise returns
* the object unchanged. This function should be used in setup code to prevent
* errors from completely halting JavaScript execution in legacy browsers.
*
* @private
*
* @exports freezeObject
*/
var freezeObject = Object.freeze;
if (!defined(freezeObject)) {
freezeObject = function(o) {
return o;
};
}
return freezeObject;
});
/*global define*/
define('Core/defaultValue',[
'./freezeObject'
], function(
freezeObject) {
"use strict";
/**
* Returns the first parameter if not undefined, otherwise the second parameter.
* Useful for setting a default value for a parameter.
*
* @exports defaultValue
*
* @example
* param = defaultValue(param, 'default');
*/
var defaultValue = function(a, b) {
if (a !== undefined) {
return a;
}
return b;
};
/**
* A frozen empty object that can be used as the default value for options passed as
* an object literal.
*/
defaultValue.EMPTY_OBJECT = freezeObject({});
return defaultValue;
});
/*global define*/
define('Core/Cartesian3',[
'./defaultValue',
'./defined',
'./DeveloperError',
'./freezeObject'
], function(
defaultValue,
defined,
DeveloperError,
freezeObject) {
"use strict";
/**
* A 3D Cartesian point.
* @alias Cartesian3
* @constructor
*
* @param {Number} [x=0.0] The X component.
* @param {Number} [y=0.0] The Y component.
* @param {Number} [z=0.0] The Z component.
*
* @see Cartesian2
* @see Cartesian4
* @see Packable
*/
var Cartesian3 = function(x, y, z) {
/**
* The X component.
* @type {Number}
* @default 0.0
*/
this.x = defaultValue(x, 0.0);
/**
* The Y component.
* @type {Number}
* @default 0.0
*/
this.y = defaultValue(y, 0.0);
/**
* The Z component.
* @type {Number}
* @default 0.0
*/
this.z = defaultValue(z, 0.0);
};
/**
* Converts the provided Spherical into Cartesian3 coordinates.
* @memberof Cartesian3
*
* @param {Spherical} spherical The Spherical to be converted to Cartesian3.
* @param {Cartesian3} [result] The object onto which to store the result.
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided.
*
* @exception {DeveloperError} spherical is required.
*/
Cartesian3.fromSpherical = function(spherical, result) {
if (!defined(spherical)) {
throw new DeveloperError('spherical is required');
}
if (!defined(result)) {
result = new Cartesian3();
}
var clock = spherical.clock;
var cone = spherical.cone;
var magnitude = defaultValue(spherical.magnitude, 1.0);
var radial = magnitude * Math.sin(cone);
result.x = radial * Math.cos(clock);
result.y = radial * Math.sin(clock);
result.z = magnitude * Math.cos(cone);
return result;
};
/**
* Creates a Cartesian3 instance from x, y and z coordinates.
* @memberof Cartesian3
*
* @param {Number} x The x coordinate.
* @param {Number} y The y coordinate.
* @param {Number} z The z coordinate.
* @param {Cartesian3} [result] The object onto which to store the result.
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided.
*/
Cartesian3.fromElements = function(x, y, z, result) {
if (!defined(result)) {
return new Cartesian3(x, y, z);
}
result.x = x;
result.y = y;
result.z = z;
return result;
};
/**
* Duplicates a Cartesian3 instance.
* @memberof Cartesian3
*
* @param {Cartesian3} cartesian The Cartesian to duplicate.
* @param {Cartesian3} [result] The object onto which to store the result.
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided. (Returns undefined if cartesian is undefined)
*/
Cartesian3.clone = function(cartesian, result) {
if (!defined(cartesian)) {
return undefined;
}
if (!defined(result)) {
return new Cartesian3(cartesian.x, cartesian.y, cartesian.z);
}
result.x = cartesian.x;
result.y = cartesian.y;
result.z = cartesian.z;
return result;
};
/**
* Creates a Cartesian3 instance from an existing Cartesian4. This simply takes the
* x, y, and z properties of the Cartesian4 and drops w.
* @function
*
* @param {Cartesian4} cartesian The Cartesian4 instance to create a Cartesian3 instance from.
* @param {Cartesian3} [result] The object onto which to store the result.
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided.
*
* @exception {DeveloperError} cartesian is required.
*/
Cartesian3.fromCartesian4 = Cartesian3.clone;
/**
* The number of elements used to pack the object into an array.
* @Type {Number}
*/
Cartesian3.packedLength = 3;
/**
* Stores the provided instance into the provided array.
* @memberof Cartesian3
*
* @param {Cartesian3} value The value to pack.
* @param {Array} array The array to pack into.
* @param {Number} [startingIndex=0] The index into the array at which to start packing the elements.
*
* @exception {DeveloperError} value is required.
* @exception {DeveloperError} array is required.
*/
Cartesian3.pack = function(value, array, startingIndex) {
if (!defined(value)) {
throw new DeveloperError('value is required');
}
if (!defined(array)) {
throw new DeveloperError('array is required');
}
startingIndex = defaultValue(startingIndex, 0);
array[startingIndex++] = value.x;
array[startingIndex++] = value.y;
array[startingIndex] = value.z;
};
/**
* Retrieves an instance from a packed array.
* @memberof Cartesian3
*
* @param {Array} array The packed array.
* @param {Number} [startingIndex=0] The starting index of the element to be unpacked.
* @param {Cartesian3} [result] The object into which to store the result.
*
* @exception {DeveloperError} array is required.
*/
Cartesian3.unpack = function(array, startingIndex, result) {
if (!defined(array)) {
throw new DeveloperError('array is required');
}
startingIndex = defaultValue(startingIndex, 0);
if (!defined(result)) {
result = new Cartesian3();
}
result.x = array[startingIndex++];
result.y = array[startingIndex++];
result.z = array[startingIndex];
return result;
};
/**
* Creates a Cartesian3 from three consecutive elements in an array.
* @memberof Cartesian3
*
* @param {Array} array The array whose three consecutive elements correspond to the x, y, and z components, respectively.
* @param {Number} [startingIndex=0] The offset into the array of the first element, which corresponds to the x component.
* @param {Cartesian3} [result] The object onto which to store the result.
*
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided.
*
* @exception {DeveloperError} array is required.
*
* @example
* // Create a Cartesian3 with (1.0, 2.0, 3.0)
* var v = [1.0, 2.0, 3.0];
* var p = Cartesian3.fromArray(v);
*
* // Create a Cartesian3 with (1.0, 2.0, 3.0) using an offset into an array
* var v2 = [0.0, 0.0, 1.0, 2.0, 3.0];
* var p2 = Cartesian3.fromArray(v2, 2);
*/
Cartesian3.fromArray = Cartesian3.unpack;
/**
* Computes the value of the maximum component for the supplied Cartesian.
* @memberof Cartesian3
*
* @param {Cartesian3} The cartesian to use.
* @returns {Number} The value of the maximum component.
*
* @exception {DeveloperError} cartesian is required.
*/
Cartesian3.getMaximumComponent = function(cartesian) {
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required');
}
return Math.max(cartesian.x, cartesian.y, cartesian.z);
};
/**
* Computes the value of the minimum component for the supplied Cartesian.
* @memberof Cartesian3
*
* @param {Cartesian3} The cartesian to use.
* @returns {Number} The value of the minimum component.
*
* @exception {DeveloperError} cartesian is required.
*/
Cartesian3.getMinimumComponent = function(cartesian) {
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required');
}
return Math.min(cartesian.x, cartesian.y, cartesian.z);
};
/**
* Computes the provided Cartesian's squared magnitude.
* @memberof Cartesian3
*
* @param {Cartesian3} cartesian The Cartesian instance whose squared magnitude is to be computed.
* @returns {Number} The squared magnitude.
*
* @exception {DeveloperError} cartesian is required.
*/
Cartesian3.magnitudeSquared = function(cartesian) {
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required');
}
return cartesian.x * cartesian.x + cartesian.y * cartesian.y + cartesian.z * cartesian.z;
};
/**
* Computes the Cartesian's magnitude (length).
* @memberof Cartesian3
*
* @param {Cartesian3} cartesian The Cartesian instance whose magnitude is to be computed.
* @returns {Number} The magnitude.
*
* @exception {DeveloperError} cartesian is required.
*/
Cartesian3.magnitude = function(cartesian) {
return Math.sqrt(Cartesian3.magnitudeSquared(cartesian));
};
var distanceScratch = new Cartesian3();
/**
* Computes the distance between two points
* @memberof Cartesian3
*
* @param {Cartesian3} left The first point to compute the distance from.
* @param {Cartesian3} right The second point to compute the distance to.
*
* @returns {Number} The distance between two points.
*
* @exception {DeveloperError} left and right are required.
*
* @example
* // Returns 1.0
* var d = Cartesian3.distance(new Cartesian3(1.0, 0.0, 0.0), new Cartesian3(2.0, 0.0, 0.0));
*/
Cartesian3.distance = function(left, right) {
if (!defined(left) || !defined(right)) {
throw new DeveloperError('left and right are required.');
}
Cartesian3.subtract(left, right, distanceScratch);
return Cartesian3.magnitude(distanceScratch);
};
/**
* Computes the normalized form of the supplied Cartesian.
* @memberof Cartesian3
*
* @param {Cartesian3} cartesian The Cartesian to be normalized.
* @param {Cartesian3} [result] The object onto which to store the result.
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided.
*
* @exception {DeveloperError} cartesian is required.
*/
Cartesian3.normalize = function(cartesian, result) {
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required');
}
var magnitude = Cartesian3.magnitude(cartesian);
if (!defined(result)) {
return new Cartesian3(cartesian.x / magnitude, cartesian.y / magnitude, cartesian.z / magnitude);
}
result.x = cartesian.x / magnitude;
result.y = cartesian.y / magnitude;
result.z = cartesian.z / magnitude;
return result;
};
/**
* Computes the dot (scalar) product of two Cartesians.
* @memberof Cartesian3
*
* @param {Cartesian3} left The first Cartesian.
* @param {Cartesian3} right The second Cartesian.
* @returns {Number} The dot product.
*
* @exception {DeveloperError} left is required.
* @exception {DeveloperError} right is required.
*/
Cartesian3.dot = function(left, right) {
if (!defined(left)) {
throw new DeveloperError('left is required');
}
if (!defined(right)) {
throw new DeveloperError('right is required');
}
return left.x * right.x + left.y * right.y + left.z * right.z;
};
/**
* Computes the componentwise product of two Cartesians.
* @memberof Cartesian3
*
* @param {Cartesian3} left The first Cartesian.
* @param {Cartesian3} right The second Cartesian.
* @param {Cartesian3} [result] The object onto which to store the result.
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided.
*
* @exception {DeveloperError} left is required.
* @exception {DeveloperError} right is required.
*/
Cartesian3.multiplyComponents = function(left, right, result) {
if (!defined(left)) {
throw new DeveloperError('left is required');
}
if (!defined(right)) {
throw new DeveloperError('right is required');
}
if (!defined(result)) {
return new Cartesian3(left.x * right.x, left.y * right.y, left.z * right.z);
}
result.x = left.x * right.x;
result.y = left.y * right.y;
result.z = left.z * right.z;
return result;
};
/**
* Computes the componentwise sum of two Cartesians.
* @memberof Cartesian3
*
* @param {Cartesian3} left The first Cartesian.
* @param {Cartesian3} right The second Cartesian.
* @param {Cartesian3} [result] The object onto which to store the result.
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided.
*
* @exception {DeveloperError} left is required.
* @exception {DeveloperError} right is required.
*/
Cartesian3.add = function(left, right, result) {
if (!defined(left)) {
throw new DeveloperError('left is required');
}
if (!defined(right)) {
throw new DeveloperError('right is required');
}
if (!defined(result)) {
return new Cartesian3(left.x + right.x, left.y + right.y, left.z + right.z);
}
result.x = left.x + right.x;
result.y = left.y + right.y;
result.z = left.z + right.z;
return result;
};
/**
* Computes the componentwise difference of two Cartesians.
* @memberof Cartesian3
*
* @param {Cartesian3} left The first Cartesian.
* @param {Cartesian3} right The second Cartesian.
* @param {Cartesian3} [result] The object onto which to store the result.
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided.
*
* @exception {DeveloperError} left is required.
* @exception {DeveloperError} right is required.
*/
Cartesian3.subtract = function(left, right, result) {
if (!defined(left)) {
throw new DeveloperError('left is required');
}
if (!defined(right)) {
throw new DeveloperError('right is required');
}
if (!defined(result)) {
return new Cartesian3(left.x - right.x, left.y - right.y, left.z - right.z);
}
result.x = left.x - right.x;
result.y = left.y - right.y;
result.z = left.z - right.z;
return result;
};
/**
* Multiplies the provided Cartesian componentwise by the provided scalar.
* @memberof Cartesian3
*
* @param {Cartesian3} cartesian The Cartesian to be scaled.
* @param {Number} scalar The scalar to multiply with.
* @param {Cartesian3} [result] The object onto which to store the result.
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided.
*
* @exception {DeveloperError} cartesian is required.
* @exception {DeveloperError} scalar is required and must be a number.
*/
Cartesian3.multiplyByScalar = function(cartesian, scalar, result) {
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required');
}
if (typeof scalar !== 'number') {
throw new DeveloperError('scalar is required and must be a number.');
}
if (!defined(result)) {
return new Cartesian3(cartesian.x * scalar, cartesian.y * scalar, cartesian.z * scalar);
}
result.x = cartesian.x * scalar;
result.y = cartesian.y * scalar;
result.z = cartesian.z * scalar;
return result;
};
/**
* Divides the provided Cartesian componentwise by the provided scalar.
* @memberof Cartesian3
*
* @param {Cartesian3} cartesian The Cartesian to be divided.
* @param {Number} scalar The scalar to divide by.
* @param {Cartesian3} [result] The object onto which to store the result.
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided.
*
* @exception {DeveloperError} cartesian is required.
* @exception {DeveloperError} scalar is required and must be a number.
*/
Cartesian3.divideByScalar = function(cartesian, scalar, result) {
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required');
}
if (typeof scalar !== 'number') {
throw new DeveloperError('scalar is required and must be a number.');
}
if (!defined(result)) {
return new Cartesian3(cartesian.x / scalar, cartesian.y / scalar, cartesian.z / scalar);
}
result.x = cartesian.x / scalar;
result.y = cartesian.y / scalar;
result.z = cartesian.z / scalar;
return result;
};
/**
* Negates the provided Cartesian.
* @memberof Cartesian3
*
* @param {Cartesian3} cartesian The Cartesian to be negated.
* @param {Cartesian3} [result] The object onto which to store the result.
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided.
*
* @exception {DeveloperError} cartesian is required.
*/
Cartesian3.negate = function(cartesian, result) {
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required');
}
if (!defined(result)) {
return new Cartesian3(-cartesian.x, -cartesian.y, -cartesian.z);
}
result.x = -cartesian.x;
result.y = -cartesian.y;
result.z = -cartesian.z;
return result;
};
/**
* Computes the absolute value of the provided Cartesian.
* @memberof Cartesian3
*
* @param {Cartesian3} cartesian The Cartesian whose absolute value is to be computed.
* @param {Cartesian3} [result] The object onto which to store the result.
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided.
*
* @exception {DeveloperError} cartesian is required.
*/
Cartesian3.abs = function(cartesian, result) {
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required');
}
if (!defined(result)) {
return new Cartesian3(Math.abs(cartesian.x), Math.abs(cartesian.y), Math.abs(cartesian.z));
}
result.x = Math.abs(cartesian.x);
result.y = Math.abs(cartesian.y);
result.z = Math.abs(cartesian.z);
return result;
};
var lerpScratch = new Cartesian3();
/**
* Computes the linear interpolation or extrapolation at t using the provided cartesians.
* @memberof Cartesian3
*
* @param start The value corresponding to t at 0.0.
* @param end The value corresponding to t at 1.0.
* @param t The point along t at which to interpolate.
* @param {Cartesian3} [result] The object onto which to store the result.
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided.
*
* @exception {DeveloperError} start is required.
* @exception {DeveloperError} end is required.
* @exception {DeveloperError} t is required and must be a number.
*/
Cartesian3.lerp = function(start, end, t, result) {
if (!defined(start)) {
throw new DeveloperError('start is required.');
}
if (!defined(end)) {
throw new DeveloperError('end is required.');
}
if (typeof t !== 'number') {
throw new DeveloperError('t is required and must be a number.');
}
Cartesian3.multiplyByScalar(end, t, lerpScratch);
result = Cartesian3.multiplyByScalar(start, 1.0 - t, result);
return Cartesian3.add(lerpScratch, result, result);
};
var angleBetweenScratch = new Cartesian3();
var angleBetweenScratch2 = new Cartesian3();
/**
* Returns the angle, in radians, between the provided Cartesians.
* @memberof Cartesian3
*
* @param {Cartesian3} left The first Cartesian.
* @param {Cartesian3} right The second Cartesian.
* @returns {Number} The angle between the Cartesians.
*
* @exception {DeveloperError} left is required.
* @exception {DeveloperError} right is required.
*/
Cartesian3.angleBetween = function(left, right) {
if (!defined(left)) {
throw new DeveloperError('left is required');
}
if (!defined(right)) {
throw new DeveloperError('right is required');
}
Cartesian3.normalize(left, angleBetweenScratch);
Cartesian3.normalize(right, angleBetweenScratch2);
var cosine = Cartesian3.dot(angleBetweenScratch, angleBetweenScratch2);
var sine = Cartesian3.magnitude(Cartesian3.cross(angleBetweenScratch, angleBetweenScratch2, angleBetweenScratch));
return Math.atan2(sine, cosine);
};
var mostOrthogonalAxisScratch = new Cartesian3();
/**
* Returns the axis that is most orthogonal to the provided Cartesian.
* @memberof Cartesian3
*
* @param {Cartesian3} cartesian The Cartesian on which to find the most orthogonal axis.
* @param {Cartesian3} [result] The object onto which to store the result.
* @returns {Cartesian3} The most orthogonal axis.
*
* @exception {DeveloperError} cartesian is required.
*/
Cartesian3.mostOrthogonalAxis = function(cartesian, result) {
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required.');
}
var f = Cartesian3.normalize(cartesian, mostOrthogonalAxisScratch);
Cartesian3.abs(f, f);
if (f.x <= f.y) {
if (f.x <= f.z) {
result = Cartesian3.clone(Cartesian3.UNIT_X, result);
} else {
result = Cartesian3.clone(Cartesian3.UNIT_Z, result);
}
} else {
if (f.y <= f.z) {
result = Cartesian3.clone(Cartesian3.UNIT_Y, result);
} else {
result = Cartesian3.clone(Cartesian3.UNIT_Z, result);
}
}
return result;
};
/**
* Compares the provided Cartesians componentwise and returns
* <code>true</code> if they are equal, <code>false</code> otherwise.
* @memberof Cartesian3
*
* @param {Cartesian3} [left] The first Cartesian.
* @param {Cartesian3} [right] The second Cartesian.
* @returns {Boolean} <code>true</code> if left and right are equal, <code>false</code> otherwise.
*/
Cartesian3.equals = function(left, right) {
return (left === right) ||
((defined(left)) &&
(defined(right)) &&
(left.x === right.x) &&
(left.y === right.y) &&
(left.z === right.z));
};
/**
* Compares the provided Cartesians componentwise and returns
* <code>true</code> if they are within the provided epsilon,
* <code>false</code> otherwise.
* @memberof Cartesian3
*
* @param {Cartesian3} [left] The first Cartesian.
* @param {Cartesian3} [right] The second Cartesian.
* @param {Number} epsilon The epsilon to use for equality testing.
* @returns {Boolean} <code>true</code> if left and right are within the provided epsilon, <code>false</code> otherwise.
*
* @exception {DeveloperError} epsilon is required and must be a number.
*/
Cartesian3.equalsEpsilon = function(left, right, epsilon) {
if (typeof epsilon !== 'number') {
throw new DeveloperError('epsilon is required and must be a number.');
}
return (left === right) ||
((defined(left)) &&
(defined(right)) &&
(Math.abs(left.x - right.x) <= epsilon) &&
(Math.abs(left.y - right.y) <= epsilon) &&
(Math.abs(left.z - right.z) <= epsilon));
};
/**
* Computes the cross (outer) product of two Cartesians.
* @memberof Cartesian3
*
* @param {Cartesian3} left The first Cartesian.
* @param {Cartesian3} right The second Cartesian.
* @param {Cartesian3} [result] The object onto which to store the result.
* @returns {Cartesian3} The cross product.
*
* @exception {DeveloperError} left is required.
* @exception {DeveloperError} right is required.
*/
Cartesian3.cross = function(left, right, result) {
if (!defined(left)) {
throw new DeveloperError('left is required');
}
if (!defined(right)) {
throw new DeveloperError('right is required');
}
var leftX = left.x;
var leftY = left.y;
var leftZ = left.z;
var rightX = right.x;
var rightY = right.y;
var rightZ = right.z;
var x = leftY * rightZ - leftZ * rightY;
var y = leftZ * rightX - leftX * rightZ;
var z = leftX * rightY - leftY * rightX;
if (!defined(result)) {
return new Cartesian3(x, y, z);
}
result.x = x;
result.y = y;
result.z = z;
return result;
};
/**
* An immutable Cartesian3 instance initialized to (0.0, 0.0, 0.0).
* @memberof Cartesian3
*/
Cartesian3.ZERO = freezeObject(new Cartesian3(0.0, 0.0, 0.0));
/**
* An immutable Cartesian3 instance initialized to (1.0, 0.0, 0.0).
* @memberof Cartesian3
*/
Cartesian3.UNIT_X = freezeObject(new Cartesian3(1.0, 0.0, 0.0));
/**
* An immutable Cartesian3 instance initialized to (0.0, 1.0, 0.0).
* @memberof Cartesian3
*/
Cartesian3.UNIT_Y = freezeObject(new Cartesian3(0.0, 1.0, 0.0));
/**
* An immutable Cartesian3 instance initialized to (0.0, 0.0, 1.0).
* @memberof Cartesian3
*/
Cartesian3.UNIT_Z = freezeObject(new Cartesian3(0.0, 0.0, 1.0));
/**
* Duplicates this Cartesian3 instance.
* @memberof Cartesian3
*
* @param {Cartesian3} [result] The object onto which to store the result.
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided.
*/
Cartesian3.prototype.clone = function(result) {
return Cartesian3.clone(this, result);
};
/**
* Creates a string representing this Cartesian in the format '(x, y, z)'.
* @memberof Cartesian3
*
* @returns {String} A string representing this Cartesian in the format '(x, y, z)'.
*/
Cartesian3.prototype.toString = function() {
return '(' + this.x + ', ' + this.y + ', ' + this.z + ')';
};
return Cartesian3;
});
/*global define*/
define('Core/Fullscreen',['./defined'], function(defined) {
"use strict";
var _supportsFullscreen;
var _names = {
requestFullscreen : undefined,
exitFullscreen : undefined,
fullscreenEnabled : undefined,
fullscreenElement : undefined,
fullscreenchange : undefined,
fullscreenerror : undefined
};
/**
* Browser-independent functions for working with the standard fullscreen API.
*
* @exports Fullscreen
*
* @see <a href='http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html'>W3C Fullscreen Living Specification</a>
*/
var Fullscreen = {};
/**
* Detects whether the browser supports the standard fullscreen API.
*
* @returns <code>true</code> if the browser supports the standard fullscreen API,
* <code>false</code> otherwise.
*/
Fullscreen.supportsFullscreen = function() {
if (defined(_supportsFullscreen)) {
return _supportsFullscreen;
}
_supportsFullscreen = false;
var body = document.body;
if (typeof body.requestFullscreen === 'function') {
// go with the unprefixed, standard set of names
_names.requestFullscreen = 'requestFullscreen';
_names.exitFullscreen = 'exitFullscreen';
_names.fullscreenEnabled = 'fullscreenEnabled';
_names.fullscreenElement = 'fullscreenElement';
_names.fullscreenchange = 'fullscreenchange';
_names.fullscreenerror = 'fullscreenerror';
_supportsFullscreen = true;
return _supportsFullscreen;
}
//check for the correct combination of prefix plus the various names that browsers use
var prefixes = ['webkit', 'moz', 'o', 'ms', 'khtml'];
var name;
for ( var i = 0, len = prefixes.length; i < len; ++i) {
var prefix = prefixes[i];
// casing of Fullscreen differs across browsers
name = prefix + 'RequestFullscreen';
if (typeof body[name] === 'function') {
_names.requestFullscreen = name;
_supportsFullscreen = true;
} else {
name = prefix + 'RequestFullScreen';
if (typeof body[name] === 'function') {
_names.requestFullscreen = name;
_supportsFullscreen = true;
}
}
// disagreement about whether it's "exit" as per spec, or "cancel"
name = prefix + 'ExitFullscreen';
if (typeof document[name] === 'function') {
_names.exitFullscreen = name;
} else {
name = prefix + 'CancelFullScreen';
if (typeof document[name] === 'function') {
_names.exitFullscreen = name;
}
}
// casing of Fullscreen differs across browsers
name = prefix + 'FullscreenEnabled';
if (defined(document[name])) {
_names.fullscreenEnabled = name;
} else {
name = prefix + 'FullScreenEnabled';
if (defined(document[name])) {
_names.fullscreenEnabled = name;
}
}
// casing of Fullscreen differs across browsers
name = prefix + 'FullscreenElement';
if (defined(document[name])) {
_names.fullscreenElement = name;
} else {
name = prefix + 'FullScreenElement';
if (defined(document[name])) {
_names.fullscreenElement = name;
}
}
// thankfully, event names are all lowercase per spec
name = prefix + 'fullscreenchange';
// event names do not have 'on' in the front, but the property on the document does
if (defined(document['on' + name])) {
_names.fullscreenchange = name;
}
name = prefix + 'fullscreenerror';
if (defined(document['on' + name])) {
_names.fullscreenerror = name;
}
}
return _supportsFullscreen;
};
/**
* Asynchronously requests the browser to enter fullscreen mode on the given element.
* If fullscreen mode is not supported by the browser, does nothing.
*
* @param {Object} element The HTML element which will be placed into fullscreen mode.
*
* @example
* // Put the entire page into fullscreen.
* Fullscreen.requestFullscreen(document.body)
*
* // Place only the Cesium canvas into fullscreen.
* Fullscreen.requestFullscreen(scene.getCanvas())
*/
Fullscreen.requestFullscreen = function(element) {
if (!Fullscreen.supportsFullscreen()) {
return;
}
element[_names.requestFullscreen]();
};
/**
* Asynchronously exits fullscreen mode. If the browser is not currently
* in fullscreen, or if fullscreen mode is not supported by the browser, does nothing.
*/
Fullscreen.exitFullscreen = function() {
if (!Fullscreen.supportsFullscreen()) {
return;
}
document[_names.exitFullscreen]();
};
/**
* Determine whether the browser will allow an element to be made fullscreen, or not.
* For example, by default, iframes cannot go fullscreen unless the containing page
* adds an "allowfullscreen" attribute (or prefixed equivalent).
*
* @returns {Boolean} <code>true</code> if the browser is able to enter fullscreen mode,
* <code>false</code> if not, and <code>undefined</code> if the browser does not
* support fullscreen mode.
*/
Fullscreen.isFullscreenEnabled = function() {
if (!Fullscreen.supportsFullscreen()) {
return undefined;
}
return document[_names.fullscreenEnabled];
};
/**
* Gets the element that is currently fullscreen, if any. To simply check if the
* browser is in fullscreen mode or not, use {@link Fullscreen#isFullscreen}.
*
* @returns {Object} the element that is currently fullscreen, or <code>null</code> if the browser is
* not in fullscreen mode, or <code>undefined</code> if the browser does not support fullscreen
* mode.
*/
Fullscreen.getFullscreenElement = function() {
if (!Fullscreen.supportsFullscreen()) {
return undefined;
}
return document[_names.fullscreenElement];
};
/**
* Determines if the browser is currently in fullscreen mode.
*
* @returns {Boolean} <code>true</code> if the browser is currently in fullscreen mode, <code>false</code>
* if it is not, or <code>undefined</code> if the browser does not support fullscreen mode.
*/
Fullscreen.isFullscreen = function() {
if (!Fullscreen.supportsFullscreen()) {
return undefined;
}
return Fullscreen.getFullscreenElement() !== null;
};
/**
* Gets the name of the event on the document that is fired when fullscreen is
* entered or exited. This event name is intended for use with addEventListener.
*
* In your event handler, to determine if the browser is in fullscreen mode or not,
* use {@link Fullscreen#isFullscreen}.
*
* @returns {String} the name of the event that is fired when fullscreen is entered or
* exited, or <code>undefined</code> if fullscreen is not supported.
*/
Fullscreen.getFullscreenChangeEventName = function() {
if (!Fullscreen.supportsFullscreen()) {
return undefined;
}
return _names.fullscreenchange;
};
/**
* Gets the name of the event that is fired when a fullscreen error
* occurs. This event name is intended for use with addEventListener.
*
* @returns {String} the name of the event that is fired when a fullscreen error occurs,
* or <code>undefined</code> if fullscreen is not supported.
*/
Fullscreen.getFullscreenErrorEventName = function() {
if (!Fullscreen.supportsFullscreen()) {
return undefined;
}
return _names.fullscreenerror;
};
return Fullscreen;
});
/*global define*/
define('Core/FeatureDetection',[
'./defined',
'./Fullscreen'
], function(
defined,
Fullscreen) {
"use strict";
function extractVersion(versionString) {
var parts = versionString.split('.');
for ( var i = 0, len = parts.length; i < len; ++i) {
parts[i] = parseInt(parts[i], 10);
}
}
var isChromeResult;
var chromeVersionResult;
function isChrome() {
if (!defined(isChromeResult)) {
var fields = (/ Chrome\/([\.0-9]+)/).exec(navigator.userAgent);
if (fields === null) {
isChromeResult = false;
} else {
isChromeResult = true;
chromeVersionResult = extractVersion(fields[1]);
}
}
return isChromeResult;
}
function chromeVersion() {
return isChrome() && chromeVersionResult;
}
var isSafariResult;
var safariVersionResult;
function isSafari() {
if (!defined(isSafariResult)) {
// Chrome contains Safari in the user agent too
if (isChrome() || !(/ Safari\/[\.0-9]+/).test(navigator.userAgent)) {
isSafariResult = false;
} else {
var fields = (/ Version\/([\.0-9]+)/).exec(navigator.userAgent);
if (fields === null) {
isSafariResult = false;
} else {
isSafariResult = true;
safariVersionResult = extractVersion(fields[1]);
}
}
}
return isSafariResult;
}
function safariVersion() {
return isSafari() && safariVersionResult;
}
var isWebkitResult;
var webkitVersionResult;
function isWebkit() {
if (!defined(isWebkitResult)) {
var fields = (/ AppleWebKit\/([\.0-9]+)(\+?)/).exec(navigator.userAgent);
if (fields === null) {
isWebkitResult = false;
} else {
isWebkitResult = true;
webkitVersionResult = extractVersion(fields[1]);
webkitVersionResult.isNightly = !!fields[2];
}
}
return isWebkitResult;
}
function webkitVersion() {
return isWebkit() && webkitVersionResult;
}
var isInternetExplorerResult;
var internetExplorerVersionResult;
function isInternetExplorer() {
if (!defined(isInternetExplorerResult)) {
var fields = (/ MSIE ([\.0-9]+)/).exec(navigator.userAgent);
if (fields === null) {
isInternetExplorerResult = false;
} else {
isInternetExplorerResult = true;
internetExplorerVersionResult = extractVersion(fields[1]);
}
}
return isInternetExplorerResult;
}
function internetExplorerVersion() {
return isInternetExplorer() && internetExplorerVersionResult;
}
/**
* A set of functions to detect whether the current browser supports
* various features.
*
* @exports FeatureDetection
*/
var FeatureDetection = {
isChrome : isChrome,
chromeVersion : chromeVersion,
isSafari : isSafari,
safariVersion : safariVersion,
isWebkit : isWebkit,
webkitVersion : webkitVersion,
isInternetExplorer : isInternetExplorer,
internetExplorerVersion : internetExplorerVersion
};
var supportsCrossOriginImagery;
/**
* Detects whether the current browser supports the use of cross-origin
* requests to load streaming imagery.
*
* @returns true if the browser can load cross-origin streaming imagery, false if not.
*
* @see <a href='http://www.w3.org/TR/cors/'>Cross-Origin Resource Sharing</a>
*/
FeatureDetection.supportsCrossOriginImagery = function() {
if (!defined(supportsCrossOriginImagery)) {
if (isSafari() && webkitVersion()[0] < 536) {
// versions of Safari below this incorrectly throw a DOM error when calling
// readPixels on a canvas containing a cross-origin image.
supportsCrossOriginImagery = false;
} else {
// any other versions of browsers that incorrectly block
// readPixels on canvas containing crossOrigin images?
supportsCrossOriginImagery = 'withCredentials' in new XMLHttpRequest();
}
}
return supportsCrossOriginImagery;
};
/**
* Detects whether the current browser supports the full screen standard.
*
* @returns true if the browser supports the full screen standard, false if not.
*
* @see Fullscreen
* @see <a href='http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html'>W3C Fullscreen Living Specification</a>
*/
FeatureDetection.supportsFullscreen = function() {
return Fullscreen.supportsFullscreen();
};
/**
* Detects whether the current browser supports typed arrays.
*
* @returns true if the browser supports typed arrays, false if not.
*
* @see <a href='http://www.khronos.org/registry/typedarray/specs/latest/'>Typed Array Specification</a>
*/
FeatureDetection.supportsTypedArrays = function() {
return typeof ArrayBuffer !== 'undefined';
};
return FeatureDetection;
});
/*global define*/
define('Core/Enumeration',['./defined'], function(defined) {
"use strict";
/**
* Constructs an enumeration that contains both a numeric value and a name.
* This is used so the name of the enumeration is available in the debugger.
*
* @param {Number} [value=undefined] The numeric value of the enumeration.
* @param {String} [name=undefined] The name of the enumeration for debugging purposes.
* @param {Object} [properties=undefined] An object containing extra properties to be added to the enumeration.
*
* @alias Enumeration
* @constructor
* @example
* // Create an object with two enumerations.
* var filter = {
* NEAREST : new Enumeration(0x2600, 'NEAREST'),
* LINEAR : new Enumeration(0x2601, 'LINEAR')
* };
*/
var Enumeration = function(value, name, properties) {
/**
* The numeric value of the enumeration.
* @type {Number}
* @default undefined
*/
this.value = value;
/**
* The name of the enumeration for debugging purposes.
* @type {String}
* @default undefined
*/
this.name = name;
if (defined(properties)) {
for ( var propertyName in properties) {
if (properties.hasOwnProperty(propertyName)) {
this[propertyName] = properties[propertyName];
}
}
}
};
/**
* Returns the numeric value of the enumeration.
*
* @memberof Enumeration
*
* @returns {Number} The numeric value of the enumeration.
*/
Enumeration.prototype.valueOf = function() {
return this.value;
};
/**
* Returns the name of the enumeration for debugging purposes.
*
* @memberof Enumeration
*
* @returns {String} The name of the enumeration for debugging purposes.
*/
Enumeration.prototype.toString = function() {
return this.name;
};
return Enumeration;
});
/*global define*/
define('Core/ComponentDatatype',[
'./defined',
'./DeveloperError',
'./FeatureDetection',
'./Enumeration'
], function(
defined,
DeveloperError,
FeatureDetection,
Enumeration) {
"use strict";
// Bail out if the browser doesn't support typed arrays, to prevent the setup function
// from failing, since we won't be able to create a WebGL context anyway.
if (!FeatureDetection.supportsTypedArrays()) {
return {};
}
/**
* Enumerations for WebGL component datatypes. Components are intrinsics,
* which form attributes, which form vertices.
*
* @alias ComponentDatatype
* @enumeration
*/
var ComponentDatatype = {
/**
* 8-bit signed byte enumeration corresponding to <code>gl.BYTE</code> and the type
* of an element in <code>Int8Array</code>.
*
* @type {Enumeration}
* @constant
* @default 0x1400
*/
BYTE : new Enumeration(0x1400, 'BYTE', {
sizeInBytes : Int8Array.BYTES_PER_ELEMENT
}),
/**
* 8-bit unsigned byte enumeration corresponding to <code>UNSIGNED_BYTE</code> and the type
* of an element in <code>Uint8Array</code>.
*
* @type {Enumeration}
* @constant
* @default 0x1401
*/
UNSIGNED_BYTE : new Enumeration(0x1401, 'UNSIGNED_BYTE', {
sizeInBytes : Uint8Array.BYTES_PER_ELEMENT
}),
/**
* 16-bit signed short enumeration corresponding to <code>SHORT</code> and the type
* of an element in <code>Int16Array</code>.
*
* @type {Enumeration}
* @constant
* @default 0x1402
*/
SHORT : new Enumeration(0x1402, 'SHORT', {
sizeInBytes : Int16Array.BYTES_PER_ELEMENT
}),
/**
* 16-bit unsigned short enumeration corresponding to <code>UNSIGNED_SHORT</code> and the type
* of an element in <code>Uint16Array</code>.
*
* @type {Enumeration}
* @constant
* @default 0x1403
*/
UNSIGNED_SHORT : new Enumeration(0x1403, 'UNSIGNED_SHORT', {
sizeInBytes : Uint16Array.BYTES_PER_ELEMENT
}),
/**
* 32-bit floating-point enumeration corresponding to <code>FLOAT</code> and the type
* of an element in <code>Float32Array</code>.
*
* @type {Enumeration}
* @constant
* @default 0x1406
*/
FLOAT : new Enumeration(0x1406, 'FLOAT', {
sizeInBytes : Float32Array.BYTES_PER_ELEMENT
}),
/**
* 64-bit floating-point enumeration corresponding to <code>gl.DOUBLE</code> (in Desktop OpenGL;
* this is not supported in WebGL, and is emulated in Cesium via {@link GeometryPipeline.encodeAttribute})
* and the type of an element in <code>Float64Array</code>.
*
* @memberOf ComponentDatatype
*
* @type {Enumeration}
* @constant
* @default 0x140A
*/
DOUBLE : new Enumeration(0x140A, 'DOUBLE', {
sizeInBytes : Float64Array.BYTES_PER_ELEMENT
})
};
/**
* Validates that the provided component datatype is a valid {@link ComponentDatatype}
*
* @param {ComponentDatatype} componentDatatype The component datatype to validate.
*
* @returns {Boolean} <code>true</code> if the provided component datatype is a valid enumeration value; otherwise, <code>false</code>.
*
* @example
* if (!ComponentDatatype.validate(componentDatatype)) {
* throw new DeveloperError('componentDatatype must be a valid enumeration value.');
* }
*/
ComponentDatatype.validate = function(componentDatatype) {
return defined(componentDatatype) && defined(componentDatatype.value) &&
(componentDatatype.value === ComponentDatatype.BYTE.value ||
componentDatatype.value === ComponentDatatype.UNSIGNED_BYTE.value ||
componentDatatype.value === ComponentDatatype.SHORT.value ||
componentDatatype.value === ComponentDatatype.UNSIGNED_SHORT.value ||
componentDatatype.value === ComponentDatatype.FLOAT.value ||
componentDatatype.value === ComponentDatatype.DOUBLE.value);
};
/**
* Creates a typed array corresponding to component data type.
* @memberof ComponentDatatype
*
* @param {ComponentDatatype} componentDatatype The component data type.
* @param {Number|Array} valuesOrLength The length of the array to create or an array.
*
* @returns {Int8Array|Uint8Array|Int16Array|Uint16Array|Float32Array|Float64Array} A typed array.
*
* @exception {DeveloperError} componentDatatype is required.
* @exception {DeveloperError} valuesOrLength is required.
* @exception {DeveloperError} componentDatatype is not a valid enumeration value.
*
* @example
* // creates a Float32Array with length of 100
* var typedArray = ComponentDatatype.createTypedArray(ComponentDatatype.FLOAT, 100);
*/
ComponentDatatype.createTypedArray = function(componentDatatype, valuesOrLength) {
if (!defined(componentDatatype)) {
throw new DeveloperError('componentDatatype is required.');
}
if (!defined(valuesOrLength)) {
throw new DeveloperError('valuesOrLength is required.');
}
switch (componentDatatype.value) {
case ComponentDatatype.BYTE.value:
return new Int8Array(valuesOrLength);
case ComponentDatatype.UNSIGNED_BYTE.value:
return new Uint8Array(valuesOrLength);
case ComponentDatatype.SHORT.value:
return new Int16Array(valuesOrLength);
case ComponentDatatype.UNSIGNED_SHORT.value:
return new Uint16Array(valuesOrLength);
case ComponentDatatype.FLOAT.value:
return new Float32Array(valuesOrLength);
case ComponentDatatype.DOUBLE.value:
return new Float64Array(valuesOrLength);
default:
throw new DeveloperError('componentDatatype is not a valid enumeration value.');
}
};
/**
* Creates a typed view of an array of bytes.
* @memberof ComponentDatatype
*
* @param {ComponentDatatype} componentDatatype The type of the view to create.
* @param {ArrayBuffer} buffer The buffer storage to use for the view.
* @param {Number} [byteOffset] The offset, in bytes, to the first element in the view.
* @param {Number} [length] The number of elements in the view.
*
* @returns {Int8Array|Uint8Array|Int16Array|Uint16Array|Float32Array|Float64Array} A typed array view of the buffer.
*
* @exception {DeveloperError} componentDatatype is required.
* @exception {DeveloperError} buffer is required.
* @exception {DeveloperError} componentDatatype is not a valid enumeration value.
*/
ComponentDatatype.createArrayBufferView = function(componentDatatype, buffer, byteOffset, length) {
if (!defined(componentDatatype)) {
throw new DeveloperError('componentDatatype is required.');
}
if (!defined(buffer)) {
throw new DeveloperError('buffer is required.');
}
switch (componentDatatype.value) {
case ComponentDatatype.BYTE.value:
return new Int8Array(buffer, byteOffset);
case ComponentDatatype.UNSIGNED_BYTE.value:
return new Uint8Array(buffer, byteOffset);
case ComponentDatatype.SHORT.value:
return new Int16Array(buffer, byteOffset);
case ComponentDatatype.UNSIGNED_SHORT.value:
return new Uint16Array(buffer, byteOffset);
case ComponentDatatype.FLOAT.value:
return new Float32Array(buffer, byteOffset);
case ComponentDatatype.DOUBLE.value:
return new Float64Array(buffer, byteOffset);
default:
throw new DeveloperError('componentDatatype is not a valid enumeration value.');
}
};
return ComponentDatatype;
});
/*global define*/
define('Core/PrimitiveType',['./Enumeration'], function(Enumeration) {
"use strict";
/**
* DOC_TBA
*
* @exports PrimitiveType
*/
var PrimitiveType = {
/**
* DOC_TBA
*
* @type {Enumeration}
* @constant
* @default 0x0000
*/
POINTS : new Enumeration(0x0000, 'POINTS'),
/**
* DOC_TBA
*
* @type {Enumeration}
* @constant
* @default 0x0001
*/
LINES : new Enumeration(0x0001, 'LINES'),
/**
* DOC_TBA
*
* @type {Enumeration}
* @constant
* @default 0x0002
*/
LINE_LOOP : new Enumeration(0x0002, 'LINE_LOOP'),
/**
* DOC_TBA
*
* @type {Enumeration}
* @constant
* @default 0x0003
*/
LINE_STRIP : new Enumeration(0x0003, 'LINE_STRIP'),
/**
* DOC_TBA
*
* @type {Enumeration}
* @constant
* @default 0x0004
*/
TRIANGLES : new Enumeration(0x0004, 'TRIANGLES'),
/**
* DOC_TBA
*
* @type {Enumeration}
* @constant
* @default 0x0004
*/
TRIANGLE_STRIP : new Enumeration(0x0005, 'TRIANGLE_STRIP'),
/**
* DOC_TBA
*
* @type {Enumeration}
* @constant
* @default 0x0006
*/
TRIANGLE_FAN : new Enumeration(0x0006, 'TRIANGLE_FAN'),
/**
* DOC_TBA
*
* @param {PrimitiveType} primitiveType
*
* @returns {Boolean}
*/
validate : function(primitiveType) {
return ((primitiveType.value === PrimitiveType.POINTS.value) ||
(primitiveType.value === PrimitiveType.LINES.value) ||
(primitiveType.value === PrimitiveType.LINE_LOOP.value) ||
(primitiveType.value === PrimitiveType.LINE_STRIP.value) ||
(primitiveType.value === PrimitiveType.TRIANGLES.value) ||
(primitiveType.value === PrimitiveType.TRIANGLE_STRIP.value) ||
(primitiveType.value === PrimitiveType.TRIANGLE_FAN.value));
}
};
return PrimitiveType;
});
/*global define*/
define('Core/Cartesian4',[
'./defaultValue',
'./defined',
'./DeveloperError',
'./freezeObject'
], function(
defaultValue,
defined,
DeveloperError,
freezeObject) {
"use strict";
/**
* A 4D Cartesian point.
* @alias Cartesian4
* @constructor
*
* @param {Number} [x=0.0] The X component.
* @param {Number} [y=0.0] The Y component.
* @param {Number} [z=0.0] The Z component.
* @param {Number} [w=0.0] The W component.
*
* @see Cartesian2
* @see Cartesian3
* @see Packable
*/
var Cartesian4 = function(x, y, z, w) {
/**
* The X component.
* @type {Number}
* @default 0.0
*/
this.x = defaultValue(x, 0.0);
/**
* The Y component.
* @type {Number}
* @default 0.0
*/
this.y = defaultValue(y, 0.0);
/**
* The Z component.
* @type {Number}
* @default 0.0
*/
this.z = defaultValue(z, 0.0);
/**
* The W component.
* @type {Number}
* @default 0.0
*/
this.w = defaultValue(w, 0.0);
};
/**
* Creates a Cartesian4 instance from x, y, z and w coordinates.
* @memberof Cartesian4
*
* @param {Number} x The x coordinate.
* @param {Number} y The y coordinate.
* @param {Number} z The z coordinate.
* @param {Number} w The w coordinate.
* @param {Cartesian4} [result] The object onto which to store the result.
* @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided.
*/
Cartesian4.fromElements = function(x, y, z, w, result) {
if (!defined(result)) {
return new Cartesian4(x, y, z, w);
}
result.x = x;
result.y = y;
result.z = z;
result.w = w;
return result;
};
/**
* Duplicates a Cartesian4 instance.
* @memberof Cartesian4
*
* @param {Cartesian4} cartesian The Cartesian to duplicate.
* @param {Cartesian4} [result] The object onto which to store the result.
* @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided. (Returns undefined if cartesian is undefined)
*/
Cartesian4.clone = function(cartesian, result) {
if (!defined(cartesian)) {
return undefined;
}
if (!defined(result)) {
return new Cartesian4(cartesian.x, cartesian.y, cartesian.z, cartesian.w);
}
result.x = cartesian.x;
result.y = cartesian.y;
result.z = cartesian.z;
result.w = cartesian.w;
return result;
};
/**
* The number of elements used to pack the object into an array.
* @Type {Number}
*/
Cartesian4.packedLength = 4;
/**
* Stores the provided instance into the provided array.
* @memberof Cartesian4
*
* @param {Cartesian4} value The value to pack.
* @param {Array} array The array to pack into.
* @param {Number} [startingIndex=0] The index into the array at which to start packing the elements.
*
* @exception {DeveloperError} value is required.
* @exception {DeveloperError} array is required.
*/
Cartesian4.pack = function(value, array, startingIndex) {
if (!defined(value)) {
throw new DeveloperError('value is required');
}
if (!defined(array)) {
throw new DeveloperError('array is required');
}
startingIndex = defaultValue(startingIndex, 0);
array[startingIndex++] = value.x;
array[startingIndex++] = value.y;
array[startingIndex++] = value.z;
array[startingIndex] = value.w;
};
/**
* Retrieves an instance from a packed array.
* @memberof Cartesian4
*
* @param {Array} array The packed array.
* @param {Number} [startingIndex=0] The starting index of the element to be unpacked.
* @param {Cartesian4} [result] The object into which to store the result.
*
* @exception {DeveloperError} array is required.
*/
Cartesian4.unpack = function(array, startingIndex, result) {
if (!defined(array)) {
throw new DeveloperError('array is required');
}
startingIndex = defaultValue(startingIndex, 0);
if (!defined(result)) {
result = new Cartesian4();
}
result.x = array[startingIndex++];
result.y = array[startingIndex++];
result.z = array[startingIndex++];
result.w = array[startingIndex];
return result;
};
/**
* Creates a Cartesian4 from four consecutive elements in an array.
* @memberof Cartesian4
*
* @param {Array} array The array whose four consecutive elements correspond to the x, y, z, and w components, respectively.
* @param {Number} [startingIndex=0] The offset into the array of the first element, which corresponds to the x component.
* @param {Cartesian4} [result] The object onto which to store the result.
*
* @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided.
*
* @exception {DeveloperError} array is required.
*
* @example
* // Create a Cartesian4 with (1.0, 2.0, 3.0, 4.0)
* var v = [1.0, 2.0, 3.0, 4.0];
* var p = Cartesian4.fromArray(v);
*
* // Create a Cartesian4 with (1.0, 2.0, 3.0, 4.0) using an offset into an array
* var v2 = [0.0, 0.0, 1.0, 2.0, 3.0, 4.0];
* var p2 = Cartesian4.fromArray(v2, 2);
*/
Cartesian4.fromArray = Cartesian4.unpack;
/**
* Computes the value of the maximum component for the supplied Cartesian.
* @memberof Cartesian4
*
* @param {Cartesian4} The cartesian to use.
* @returns {Number} The value of the maximum component.
*
* @exception {DeveloperError} cartesian is required.
*/
Cartesian4.getMaximumComponent = function(cartesian) {
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required');
}
return Math.max(cartesian.x, cartesian.y, cartesian.z, cartesian.w);
};
/**
* Computes the value of the minimum component for the supplied Cartesian.
* @memberof Cartesian4
*
* @param {Cartesian4} The cartesian to use.
* @returns {Number} The value of the minimum component.
*
* @exception {DeveloperError} cartesian is required.
*/
Cartesian4.getMinimumComponent = function(cartesian) {
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required');
}
return Math.min(cartesian.x, cartesian.y, cartesian.z, cartesian.w);
};
/**
* Computes the provided Cartesian's squared magnitude.
* @memberof Cartesian4
*
* @param {Cartesian4} cartesian The Cartesian instance whose squared magnitude is to be computed.
* @returns {Number} The squared magnitude.
*
* @exception {DeveloperError} cartesian is required.
*/
Cartesian4.magnitudeSquared = function(cartesian) {
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required');
}
return cartesian.x * cartesian.x + cartesian.y * cartesian.y + cartesian.z * cartesian.z + cartesian.w * cartesian.w;
};
/**
* Computes the Cartesian's magnitude (length).
* @memberof Cartesian4
*
* @param {Cartesian4} cartesian The Cartesian instance whose magnitude is to be computed.
* @returns {Number} The magnitude.
*
* @exception {DeveloperError} cartesian is required.
*/
Cartesian4.magnitude = function(cartesian) {
return Math.sqrt(Cartesian4.magnitudeSquared(cartesian));
};
var distanceScratch = new Cartesian4();
/**
* Computes the 4-space distance between two points
* @memberof Cartesian4
*
* @param {Cartesian4} left The first point to compute the distance from.
* @param {Cartesian4} right The second point to compute the distance to.
*
* @returns {Number} The distance between two points.
*
* @exception {DeveloperError} left and right are required.
*
* @example
* // Returns 1.0
* var d = Cartesian4.distance(new Cartesian4(1.0, 0.0, 0.0, 0.0), new Cartesian4(2.0, 0.0, 0.0, 0.0));
*/
Cartesian4.distance = function(left, right) {
if (!defined(left) || !defined(right)) {
throw new DeveloperError('left and right are required.');
}
Cartesian4.subtract(left, right, distanceScratch);
return Cartesian4.magnitude(distanceScratch);
};
/**
* Computes the normalized form of the supplied Cartesian.
* @memberof Cartesian4
*
* @param {Cartesian4} cartesian The Cartesian to be normalized.
* @param {Cartesian4} [result] The object onto which to store the result.
* @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided.
*
* @exception {DeveloperError} cartesian is required.
*/
Cartesian4.normalize = function(cartesian, result) {
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required');
}
var magnitude = Cartesian4.magnitude(cartesian);
if (!defined(result)) {
return new Cartesian4(cartesian.x / magnitude, cartesian.y / magnitude, cartesian.z / magnitude, cartesian.w / magnitude);
}
result.x = cartesian.x / magnitude;
result.y = cartesian.y / magnitude;
result.z = cartesian.z / magnitude;
result.w = cartesian.w / magnitude;
return result;
};
/**
* Computes the dot (scalar) product of two Cartesians.
* @memberof Cartesian4
*
* @param {Cartesian4} left The first Cartesian.
* @param {Cartesian4} right The second Cartesian.
* @returns {Number} The dot product.
*
* @exception {DeveloperError} left is required.
* @exception {DeveloperError} right is required.
*/
Cartesian4.dot = function(left, right) {
if (!defined(left)) {
throw new DeveloperError('left is required');
}
if (!defined(right)) {
throw new DeveloperError('right is required');
}
return left.x * right.x + left.y * right.y + left.z * right.z + left.w * right.w;
};
/**
* Computes the componentwise product of two Cartesians.
* @memberof Cartesian4
*
* @param {Cartesian4} left The first Cartesian.
* @param {Cartesian4} right The second Cartesian.
* @param {Cartesian4} [result] The object onto which to store the result.
* @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided.
*
* @exception {DeveloperError} left is required.
* @exception {DeveloperError} right is required.
*/
Cartesian4.multiplyComponents = function(left, right, result) {
if (!defined(left)) {
throw new DeveloperError('left is required');
}
if (!defined(right)) {
throw new DeveloperError('right is required');
}
if (!defined(result)) {
return new Cartesian4(left.x * right.x, left.y * right.y, left.z * right.z, left.w * right.w);
}
result.x = left.x * right.x;
result.y = left.y * right.y;
result.z = left.z * right.z;
result.w = left.w * right.w;
return result;
};
/**
* Computes the componentwise sum of two Cartesians.
* @memberof Cartesian4
*
* @param {Cartesian4} left The first Cartesian.
* @param {Cartesian4} right The second Cartesian.
* @param {Cartesian4} [result] The object onto which to store the result.
* @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided.
*
* @exception {DeveloperError} left is required.
* @exception {DeveloperError} right is required.
*/
Cartesian4.add = function(left, right, result) {
if (!defined(left)) {
throw new DeveloperError('left is required');
}
if (!defined(right)) {
throw new DeveloperError('right is required');
}
if (!defined(result)) {
return new Cartesian4(left.x + right.x, left.y + right.y, left.z + right.z, left.w + right.w);
}
result.x = left.x + right.x;
result.y = left.y + right.y;
result.z = left.z + right.z;
result.w = left.w + right.w;
return result;
};
/**
* Computes the componentwise difference of two Cartesians.
* @memberof Cartesian4
*
* @param {Cartesian4} left The first Cartesian.
* @param {Cartesian4} right The second Cartesian.
* @param {Cartesian4} [result] The object onto which to store the result.
* @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided.
*
* @exception {DeveloperError} left is required.
* @exception {DeveloperError} right is required.
*/
Cartesian4.subtract = function(left, right, result) {
if (!defined(left)) {
throw new DeveloperError('left is required');
}
if (!defined(right)) {
throw new DeveloperError('right is required');
}
if (!defined(result)) {
return new Cartesian4(left.x - right.x, left.y - right.y, left.z - right.z, left.w - right.w);
}
result.x = left.x - right.x;
result.y = left.y - right.y;
result.z = left.z - right.z;
result.w = left.w - right.w;
return result;
};
/**
* Multiplies the provided Cartesian componentwise by the provided scalar.
* @memberof Cartesian4
*
* @param {Cartesian4} cartesian The Cartesian to be scaled.
* @param {Number} scalar The scalar to multiply with.
* @param {Cartesian4} [result] The object onto which to store the result.
* @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided.
*
* @exception {DeveloperError} cartesian is required.
* @exception {DeveloperError} scalar is required and must be a number.
*/
Cartesian4.multiplyByScalar = function(cartesian, scalar, result) {
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required');
}
if (typeof scalar !== 'number') {
throw new DeveloperError('scalar is required and must be a number.');
}
if (!defined(result)) {
return new Cartesian4(cartesian.x * scalar, cartesian.y * scalar, cartesian.z * scalar, cartesian.w * scalar);
}
result.x = cartesian.x * scalar;
result.y = cartesian.y * scalar;
result.z = cartesian.z * scalar;
result.w = cartesian.w * scalar;
return result;
};
/**
* Divides the provided Cartesian componentwise by the provided scalar.
* @memberof Cartesian4
*
* @param {Cartesian4} cartesian The Cartesian to be divided.
* @param {Number} scalar The scalar to divide by.
* @param {Cartesian4} [result] The object onto which to store the result.
* @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided.
*
* @exception {DeveloperError} cartesian is required.
* @exception {DeveloperError} scalar is required and must be a number.
*/
Cartesian4.divideByScalar = function(cartesian, scalar, result) {
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required');
}
if (typeof scalar !== 'number') {
throw new DeveloperError('scalar is required and must be a number.');
}
if (!defined(result)) {
return new Cartesian4(cartesian.x / scalar, cartesian.y / scalar, cartesian.z / scalar, cartesian.w / scalar);
}
result.x = cartesian.x / scalar;
result.y = cartesian.y / scalar;
result.z = cartesian.z / scalar;
result.w = cartesian.w / scalar;
return result;
};
/**
* Negates the provided Cartesian.
* @memberof Cartesian4
*
* @param {Cartesian4} cartesian The Cartesian to be negated.
* @param {Cartesian4} [result] The object onto which to store the result.
* @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided.
*
* @exception {DeveloperError} cartesian is required.
*/
Cartesian4.negate = function(cartesian, result) {
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required');
}
if (!defined(result)) {
return new Cartesian4(-cartesian.x, -cartesian.y, -cartesian.z, -cartesian.w);
}
result.x = -cartesian.x;
result.y = -cartesian.y;
result.z = -cartesian.z;
result.w = -cartesian.w;
return result;
};
/**
* Computes the absolute value of the provided Cartesian.
* @memberof Cartesian4
*
* @param {Cartesian4} cartesian The Cartesian whose absolute value is to be computed.
* @param {Cartesian4} [result] The object onto which to store the result.
* @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided.
*
* @exception {DeveloperError} cartesian is required.
*/
Cartesian4.abs = function(cartesian, result) {
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required');
}
if (!defined(result)) {
return new Cartesian4(Math.abs(cartesian.x), Math.abs(cartesian.y), Math.abs(cartesian.z), Math.abs(cartesian.w));
}
result.x = Math.abs(cartesian.x);
result.y = Math.abs(cartesian.y);
result.z = Math.abs(cartesian.z);
result.w = Math.abs(cartesian.w);
return result;
};
var lerpScratch = new Cartesian4();
/**
* Computes the linear interpolation or extrapolation at t using the provided cartesians.
* @memberof Cartesian4
*
* @param start The value corresponding to t at 0.0.
* @param end The value corresponding to t at 1.0.
* @param t The point along t at which to interpolate.
* @param {Cartesian4} [result] The object onto which to store the result.
* @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided.
*
* @exception {DeveloperError} start is required.
* @exception {DeveloperError} end is required.
* @exception {DeveloperError} t is required and must be a number.
*/
Cartesian4.lerp = function(start, end, t, result) {
if (!defined(start)) {
throw new DeveloperError('start is required.');
}
if (!defined(end)) {
throw new DeveloperError('end is required.');
}
if (typeof t !== 'number') {
throw new DeveloperError('t is required and must be a number.');
}
Cartesian4.multiplyByScalar(end, t, lerpScratch);
result = Cartesian4.multiplyByScalar(start, 1.0 - t, result);
return Cartesian4.add(lerpScratch, result, result);
};
var mostOrthogonalAxisScratch = new Cartesian4();
/**
* Returns the axis that is most orthogonal to the provided Cartesian.
* @memberof Cartesian4
*
* @param {Cartesian4} cartesian The Cartesian on which to find the most orthogonal axis.
* @param {Cartesian4} [result] The object onto which to store the result.
* @returns {Cartesian4} The most orthogonal axis.
*
* @exception {DeveloperError} cartesian is required.
*/
Cartesian4.mostOrthogonalAxis = function(cartesian, result) {
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required.');
}
var f = Cartesian4.normalize(cartesian, mostOrthogonalAxisScratch);
Cartesian4.abs(f, f);
if (f.x <= f.y) {
if (f.x <= f.z) {
if (f.x <= f.w) {
result = Cartesian4.clone(Cartesian4.UNIT_X, result);
} else {
result = Cartesian4.clone(Cartesian4.UNIT_W, result);
}
} else if (f.z <= f.w) {
result = Cartesian4.clone(Cartesian4.UNIT_Z, result);
} else {
result = Cartesian4.clone(Cartesian4.UNIT_W, result);
}
} else if (f.y <= f.z) {
if (f.y <= f.w) {
result = Cartesian4.clone(Cartesian4.UNIT_Y, result);
} else {
result = Cartesian4.clone(Cartesian4.UNIT_W, result);
}
} else if (f.z <= f.w) {
result = Cartesian4.clone(Cartesian4.UNIT_Z, result);
} else {
result = Cartesian4.clone(Cartesian4.UNIT_W, result);
}
return result;
};
/**
* Compares the provided Cartesians componentwise and returns
* <code>true</code> if they are equal, <code>false</code> otherwise.
* @memberof Cartesian4
*
* @param {Cartesian4} [left] The first Cartesian.
* @param {Cartesian4} [right] The second Cartesian.
* @returns {Boolean} <code>true</code> if left and right are equal, <code>false</code> otherwise.
*/
Cartesian4.equals = function(left, right) {
return (left === right) ||
((defined(left)) &&
(defined(right)) &&
(left.x === right.x) &&
(left.y === right.y) &&
(left.z === right.z) &&
(left.w === right.w));
};
/**
* Compares the provided Cartesians componentwise and returns
* <code>true</code> if they are within the provided epsilon,
* <code>false</code> otherwise.
* @memberof Cartesian4
*
* @param {Cartesian4} [left] The first Cartesian.
* @param {Cartesian4} [right] The second Cartesian.
* @param {Number} epsilon The epsilon to use for equality testing.
* @returns {Boolean} <code>true</code> if left and right are within the provided epsilon, <code>false</code> otherwise.
*
* @exception {DeveloperError} epsilon is required and must be a number.
*/
Cartesian4.equalsEpsilon = function(left, right, epsilon) {
if (typeof epsilon !== 'number') {
throw new DeveloperError('epsilon is required and must be a number.');
}
return (left === right) ||
((defined(left)) &&
(defined(right)) &&
(Math.abs(left.x - right.x) <= epsilon) &&
(Math.abs(left.y - right.y) <= epsilon) &&
(Math.abs(left.z - right.z) <= epsilon) &&
(Math.abs(left.w - right.w) <= epsilon));
};
/**
* An immutable Cartesian4 instance initialized to (0.0, 0.0, 0.0, 0.0).
* @memberof Cartesian4
*/
Cartesian4.ZERO = freezeObject(new Cartesian4(0.0, 0.0, 0.0, 0.0));
/**
* An immutable Cartesian4 instance initialized to (1.0, 0.0, 0.0, 0.0).
* @memberof Cartesian4
*/
Cartesian4.UNIT_X = freezeObject(new Cartesian4(1.0, 0.0, 0.0, 0.0));
/**
* An immutable Cartesian4 instance initialized to (0.0, 1.0, 0.0, 0.0).
* @memberof Cartesian4
*/
Cartesian4.UNIT_Y = freezeObject(new Cartesian4(0.0, 1.0, 0.0, 0.0));
/**
* An immutable Cartesian4 instance initialized to (0.0, 0.0, 1.0, 0.0).
* @memberof Cartesian4
*/
Cartesian4.UNIT_Z = freezeObject(new Cartesian4(0.0, 0.0, 1.0, 0.0));
/**
* An immutable Cartesian4 instance initialized to (0.0, 0.0, 0.0, 1.0).
* @memberof Cartesian4
*/
Cartesian4.UNIT_W = freezeObject(new Cartesian4(0.0, 0.0, 0.0, 1.0));
/**
* Duplicates this Cartesian4 instance.
* @memberof Cartesian4
*
* @param {Cartesian4} [result] The object onto which to store the result.
* @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided.
*/
Cartesian4.prototype.clone = function(result) {
return Cartesian4.clone(this, result);
};
/**
* Creates a string representing this Cartesian in the format '(x, y)'.
* @memberof Cartesian4
*
* @returns {String} A string representing the provided Cartesian in the format '(x, y)'.
*/
Cartesian4.prototype.toString = function() {
return '(' + this.x + ', ' + this.y + ', ' + this.z + ', ' + this.w + ')';
};
return Cartesian4;
});
/*
I've wrapped Makoto Matsumoto and Takuji Nishimura's code in a namespace
so it's better encapsulated. Now you can have multiple random number generators
and they won't stomp all over eachother's state.
If you want to use this as a substitute for Math.random(), use the random()
method like so:
var m = new MersenneTwister();
var randomNumber = m.random();
You can also call the other genrand_{foo}() methods on the instance.
If you want to use a specific seed in order to get a repeatable random
sequence, pass an integer into the constructor:
var m = new MersenneTwister(123);
and that will always produce the same random sequence.
Sean McCullough (banksean@gmail.com)
*/
/*
A C-program for MT19937, with initialization improved 2002/1/26.
Coded by Takuji Nishimura and Makoto Matsumoto.
Before using, initialize the state by using init_genrand(seed)
or init_by_array(init_key, key_length).
*/
/**
@license
mersenne-twister.js - https://gist.github.com/banksean/300494
Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The names of its contributors may not be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
Any feedback is very welcome.
http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)
*/
define('ThirdParty/mersenne-twister',[],function() {
var MersenneTwister = function(seed) {
if (seed == undefined) {
seed = new Date().getTime();
}
/* Period parameters */
this.N = 624;
this.M = 397;
this.MATRIX_A = 0x9908b0df; /* constant vector a */
this.UPPER_MASK = 0x80000000; /* most significant w-r bits */
this.LOWER_MASK = 0x7fffffff; /* least significant r bits */
this.mt = new Array(this.N); /* the array for the state vector */
this.mti=this.N+1; /* mti==N+1 means mt[N] is not initialized */
this.init_genrand(seed);
}
/* initializes mt[N] with a seed */
MersenneTwister.prototype.init_genrand = function(s) {
this.mt[0] = s >>> 0;
for (this.mti=1; this.mti<this.N; this.mti++) {
var s = this.mt[this.mti-1] ^ (this.mt[this.mti-1] >>> 30);
this.mt[this.mti] = (((((s & 0xffff0000) >>> 16) * 1812433253) << 16) + (s & 0x0000ffff) * 1812433253)
+ this.mti;
/* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */
/* In the previous versions, MSBs of the seed affect */
/* only MSBs of the array mt[]. */
/* 2002/01/09 modified by Makoto Matsumoto */
this.mt[this.mti] >>>= 0;
/* for >32 bit machines */
}
}
/* initialize by an array with array-length */
/* init_key is the array for initializing keys */
/* key_length is its length */
/* slight change for C++, 2004/2/26 */
//MersenneTwister.prototype.init_by_array = function(init_key, key_length) {
// var i, j, k;
// this.init_genrand(19650218);
// i=1; j=0;
// k = (this.N>key_length ? this.N : key_length);
// for (; k; k--) {
// var s = this.mt[i-1] ^ (this.mt[i-1] >>> 30)
// this.mt[i] = (this.mt[i] ^ (((((s & 0xffff0000) >>> 16) * 1664525) << 16) + ((s & 0x0000ffff) * 1664525)))
// + init_key[j] + j; /* non linear */
// this.mt[i] >>>= 0; /* for WORDSIZE > 32 machines */
// i++; j++;
// if (i>=this.N) { this.mt[0] = this.mt[this.N-1]; i=1; }
// if (j>=key_length) j=0;
// }
// for (k=this.N-1; k; k--) {
// var s = this.mt[i-1] ^ (this.mt[i-1] >>> 30);
// this.mt[i] = (this.mt[i] ^ (((((s & 0xffff0000) >>> 16) * 1566083941) << 16) + (s & 0x0000ffff) * 1566083941))
// - i; /* non linear */
// this.mt[i] >>>= 0; /* for WORDSIZE > 32 machines */
// i++;
// if (i>=this.N) { this.mt[0] = this.mt[this.N-1]; i=1; }
// }
//
// this.mt[0] = 0x80000000; /* MSB is 1; assuring non-zero initial array */
//}
/* generates a random number on [0,0xffffffff]-interval */
MersenneTwister.prototype.genrand_int32 = function() {
var y;
var mag01 = new Array(0x0, this.MATRIX_A);
/* mag01[x] = x * MATRIX_A for x=0,1 */
if (this.mti >= this.N) { /* generate N words at one time */
var kk;
if (this.mti == this.N+1) /* if init_genrand() has not been called, */
this.init_genrand(5489); /* a default initial seed is used */
for (kk=0;kk<this.N-this.M;kk++) {
y = (this.mt[kk]&this.UPPER_MASK)|(this.mt[kk+1]&this.LOWER_MASK);
this.mt[kk] = this.mt[kk+this.M] ^ (y >>> 1) ^ mag01[y & 0x1];
}
for (;kk<this.N-1;kk++) {
y = (this.mt[kk]&this.UPPER_MASK)|(this.mt[kk+1]&this.LOWER_MASK);
this.mt[kk] = this.mt[kk+(this.M-this.N)] ^ (y >>> 1) ^ mag01[y & 0x1];
}
y = (this.mt[this.N-1]&this.UPPER_MASK)|(this.mt[0]&this.LOWER_MASK);
this.mt[this.N-1] = this.mt[this.M-1] ^ (y >>> 1) ^ mag01[y & 0x1];
this.mti = 0;
}
y = this.mt[this.mti++];
/* Tempering */
y ^= (y >>> 11);
y ^= (y << 7) & 0x9d2c5680;
y ^= (y << 15) & 0xefc60000;
y ^= (y >>> 18);
return y >>> 0;
}
/* generates a random number on [0,0x7fffffff]-interval */
//MersenneTwister.prototype.genrand_int31 = function() {
// return (this.genrand_int32()>>>1);
//}
/* generates a random number on [0,1]-real-interval */
//MersenneTwister.prototype.genrand_real1 = function() {
// return this.genrand_int32()*(1.0/4294967295.0);
// /* divided by 2^32-1 */
//}
/* generates a random number on [0,1)-real-interval */
MersenneTwister.prototype.random = function() {
return this.genrand_int32()*(1.0/4294967296.0);
/* divided by 2^32 */
}
/* generates a random number on (0,1)-real-interval */
//MersenneTwister.prototype.genrand_real3 = function() {
// return (this.genrand_int32() + 0.5)*(1.0/4294967296.0);
// /* divided by 2^32 */
//}
/* generates a random number on [0,1) with 53-bit resolution*/
//MersenneTwister.prototype.genrand_res53 = function() {
// var a=this.genrand_int32()>>>5, b=this.genrand_int32()>>>6;
// return(a*67108864.0+b)*(1.0/9007199254740992.0);
//}
/* These real versions are due to Isaku Wada, 2002/01/09 added */
return MersenneTwister;
});
/*global define*/
define('Core/Math',[
'./defaultValue',
'./defined',
'./DeveloperError',
'../ThirdParty/mersenne-twister'
], function(
defaultValue,
defined,
DeveloperError,
MersenneTwister) {
"use strict";
/**
* Math functions.
* @exports CesiumMath
*/
var CesiumMath = {};
/**
* 0.1
* @type {Number}
* @constant
*/
CesiumMath.EPSILON1 = 0.1;
/**
* 0.01
* @type {Number}
* @constant
*/
CesiumMath.EPSILON2 = 0.01;
/**
* 0.001
* @type {Number}
* @constant
*/
CesiumMath.EPSILON3 = 0.001;
/**
* 0.0001
* @type {Number}
* @constant
*/
CesiumMath.EPSILON4 = 0.0001;
/**
* 0.00001
* @type {Number}
* @constant
*/
CesiumMath.EPSILON5 = 0.00001;
/**
* 0.000001
* @type {Number}
* @constant
*/
CesiumMath.EPSILON6 = 0.000001;
/**
* 0.0000001
* @type {Number}
* @constant
*/
CesiumMath.EPSILON7 = 0.0000001;
/**
* 0.00000001
* @type {Number}
* @constant
*/
CesiumMath.EPSILON8 = 0.00000001;
/**
* 0.000000001
* @type {Number}
* @constant
*/
CesiumMath.EPSILON9 = 0.000000001;
/**
* 0.0000000001
* @type {Number}
* @constant
*/
CesiumMath.EPSILON10 = 0.0000000001;
/**
* 0.00000000001
* @type {Number}
* @constant
*/
CesiumMath.EPSILON11 = 0.00000000001;
/**
* 0.000000000001
* @type {Number}
* @constant
*/
CesiumMath.EPSILON12 = 0.000000000001;
/**
* 0.0000000000001
* @type {Number}
* @constant
*/
CesiumMath.EPSILON13 = 0.0000000000001;
/**
* 0.00000000000001
* @type {Number}
* @constant
*/
CesiumMath.EPSILON14 = 0.00000000000001;
/**
* 0.000000000000001
* @type {Number}
* @constant
*/
CesiumMath.EPSILON15 = 0.000000000000001;
/**
* 0.0000000000000001
* @type {Number}
* @constant
*/
CesiumMath.EPSILON16 = 0.0000000000000001;
/**
* 0.00000000000000001
* @type {Number}
* @constant
*/
CesiumMath.EPSILON17 = 0.00000000000000001;
/**
* 0.000000000000000001
* @type {Number}
* @constant
*/
CesiumMath.EPSILON18 = 0.000000000000000001;
/**
* 0.0000000000000000001
* @type {Number}
* @constant
*/
CesiumMath.EPSILON19 = 0.0000000000000000001;
/**
* 0.00000000000000000001
* @type {Number}
* @constant
*/
CesiumMath.EPSILON20 = 0.00000000000000000001;
/**
* 3.986004418e14
* @type {Number}
* @constant
*/
CesiumMath.GRAVITATIONALPARAMETER = 3.986004418e14;
/**
* Radius of the sun in meters: 6.955e8
* @type {Number}
* @constant
*/
CesiumMath.SOLAR_RADIUS = 6.955e8;
/**
* 64 * 1024
* @type {Number}
* @constant
*/
CesiumMath.SIXTY_FOUR_KILOBYTES = 64 * 1024;
/**
* Returns the sign of the value; 1 if the value is positive, -1 if the value is
* negative, or 0 if the value is 0.
*
* @param {Number} value The value to return the sign of.
*
* @returns {Number} The sign of value.
*/
CesiumMath.sign = function(value) {
if (value > 0) {
return 1;
}
if (value < 0) {
return -1;
}
return 0;
};
/**
* Returns the hyperbolic sine of a {@code Number}.
* The hyperbolic sine of <em>value</em> is defined to be
* (<em>e<sup>x</sup> - e<sup>-x</sup></em>)/2.0
* where <i>e</i> is Euler's number, approximately 2.71828183.
*
* <p>Special cases:
* <ul>
* <li>If the argument is NaN, then the result is NaN.</li>
*
* <li>If the argument is infinite, then the result is an infinity
* with the same sign as the argument.</li>
*
* <li>If the argument is zero, then the result is a zero with the
* same sign as the argument.</li>
* </ul>
*</p>
*
* @param value The number whose hyperbolic sine is to be returned.
*
* @returns The hyperbolic sine of {@code value}.
*
*/
CesiumMath.sinh = function(value) {
var part1 = Math.pow(Math.E, value);
var part2 = Math.pow(Math.E, -1.0 * value);
return (part1 - part2) * 0.5;
};
/**
* Returns the hyperbolic cosine of a {@code Number}.
* The hyperbolic cosine of <strong>value</strong> is defined to be
* (<em>e<sup>x</sup> + e<sup>-x</sup></em>)/2.0
* where <i>e</i> is Euler's number, approximately 2.71828183.
*
* <p>Special cases:
* <ul>
* <li>If the argument is NaN, then the result is NaN.</li>
*
* <li>If the argument is infinite, then the result is positive infinity.</li>
*
* <li>If the argument is zero, then the result is {@code 1.0}.</li>
* </ul>
*</p>
*
* @param value The number whose hyperbolic cosine is to be returned.
*
* @returns The hyperbolic cosine of {@code value}.
*/
CesiumMath.cosh = function(value) {
var part1 = Math.pow(Math.E, value);
var part2 = Math.pow(Math.E, -1.0 * value);
return (part1 + part2) * 0.5;
};
/**
* DOC_TBA
*/
CesiumMath.lerp = function(p, q, time) {
return ((1.0 - time) * p) + (time * q);
};
/**
* pi
*
* @type {Number}
* @constant
* @see czm_pi
*/
CesiumMath.PI = Math.PI;
/**
* 1/pi
*
* @type {Number}
* @constant
* @see czm_oneOverPi
*/
CesiumMath.ONE_OVER_PI = 1.0 / Math.PI;
/**
* pi/2
*
* @type {Number}
* @constant
* @see czm_piOverTwo
*/
CesiumMath.PI_OVER_TWO = Math.PI * 0.5;
/**
* pi/3
*
* @type {Number}
* @constant
* @see czm_piOverThree
*/
CesiumMath.PI_OVER_THREE = Math.PI / 3.0;
/**
* pi/4
*
* @type {Number}
* @constant
* @see czm_piOverFour
*/
CesiumMath.PI_OVER_FOUR = Math.PI / 4.0;
/**
* pi/6
*
* @type {Number}
* @constant
* @see czm_piOverSix
*/
CesiumMath.PI_OVER_SIX = Math.PI / 6.0;
/**
* 3pi/2
*
* @type {Number}
* @constant
* @see czm_threePiOver2
*/
CesiumMath.THREE_PI_OVER_TWO = (3.0 * Math.PI) * 0.5;
/**
* 2pi
*
* @type {Number}
* @constant
* @see czm_twoPi
*/
CesiumMath.TWO_PI = 2.0 * Math.PI;
/**
* 1/2pi
*
* @type {Number}
* @constant
* @see czm_oneOverTwoPi
*/
CesiumMath.ONE_OVER_TWO_PI = 1.0 / (2.0 * Math.PI);
/**
* The number of radians in a degree.
*
* @type {Number}
* @constant
* @default Math.PI / 180.0
* @see czm_radiansPerDegree
*/
CesiumMath.RADIANS_PER_DEGREE = Math.PI / 180.0;
/**
* The number of degrees in a radian.
*
* @type {Number}
* @constant
* @default 180.0 / Math.PI
* @see czm_degreesPerRadian
*/
CesiumMath.DEGREES_PER_RADIAN = 180.0 / Math.PI;
/**
* The number of radians in an arc second.
*
* @type {Number}
* @constant
* @default {@link CesiumMath.RADIANS_PER_DEGREE} / 3600.0
* @see czm_radiansPerArcSecond
*/
CesiumMath.RADIANS_PER_ARCSECOND = CesiumMath.RADIANS_PER_DEGREE / 3600.0;
/**
* Converts degrees to radians.
* @param {Number} degrees The angle to convert in degrees.
* @returns {Number} The corresponding angle in radians.
*/
CesiumMath.toRadians = function(degrees) {
return degrees * CesiumMath.RADIANS_PER_DEGREE;
};
/**
* Converts radians to degrees.
* @param {Number} radians The angle to convert in radians.
* @returns {Number} The corresponding angle in degrees.
*/
CesiumMath.toDegrees = function(radians) {
return radians * CesiumMath.DEGREES_PER_RADIAN;
};
/**
* Converts a longitude value, in radians, to the range [<code>-Math.PI</code>, <code>Math.PI</code>).
*
* @param {Number} angle The longitude value, in radians, to convert to the range [<code>-Math.PI</code>, <code>Math.PI</code>).
*
* @returns {Number} The equivalent longitude value in the range [<code>-Math.PI</code>, <code>Math.PI</code>).
*
* @example
* // Convert 270 degrees to -90 degrees longitude
* var longitude = CesiumMath.convertLongitudeRange(CesiumMath.toRadians(270.0));
*/
CesiumMath.convertLongitudeRange = function(angle) {
var twoPi = CesiumMath.TWO_PI;
var simplified = angle - Math.floor(angle / twoPi) * twoPi;
if (simplified < -Math.PI) {
return simplified + twoPi;
}
if (simplified >= Math.PI) {
return simplified - twoPi;
}
return simplified;
};
/**
* Produces an angle in the range 0 <= angle <= 2Pi which is equivalent to the provided angle.
* @param {Number} angle in radians
* @returns {Number} The angle in the range ()<code>-CesiumMath.PI</code>, <code>CesiumMath.PI</code>).
*/
CesiumMath.negativePiToPi = function(x) {
var epsilon10 = CesiumMath.EPSILON10;
var pi = CesiumMath.PI;
var two_pi = CesiumMath.TWO_PI;
while (x < -(pi + epsilon10)) {
x += two_pi;
}
if (x < -pi) {
return -pi;
}
while (x > pi + epsilon10) {
x -= two_pi;
}
return x > pi ? pi : x;
};
/**
* Produces an angle in the range -Pi <= angle <= Pi which is equivalent to the provided angle.
* @param {Number} angle in radians
* @returns {Number} The angle in the range (0 , <code>CesiumMath.TWO_PI</code>).
*/
CesiumMath.zeroToTwoPi = function(x) {
var value = x % CesiumMath.TWO_PI;
// We do a second modules here if we add 2Pi to ensure that we don't have any numerical issues with very
// small negative values.
return (value < 0.0) ? (value + CesiumMath.TWO_PI) % CesiumMath.TWO_PI : value;
};
/**
* DOC_TBA
*/
CesiumMath.equalsEpsilon = function(left, right, epsilon) {
epsilon = defaultValue(epsilon, 0.0);
return Math.abs(left - right) <= epsilon;
};
var factorials = [1];
/**
* Computes the factorial of the provided number.
*
* @memberof CesiumMath
*
* @param {Number} n The number whose factorial is to be computed.
*
* @returns {Number} The factorial of the provided number or undefined if the number is less than 0.
*
* @see <a href='http://en.wikipedia.org/wiki/Factorial'>Factorial on Wikipedia</a>.
*
* @example
* //Compute 7!, which is equal to 5040
* var computedFactorial = CesiumMath.factorial(7);
*
* @exception {DeveloperError} A number greater than or equal to 0 is required.
*/
CesiumMath.factorial = function(n) {
if (typeof n !== 'number' || n < 0) {
throw new DeveloperError('A number greater than or equal to 0 is required.');
}
var length = factorials.length;
if (n >= length) {
var sum = factorials[length - 1];
for ( var i = length; i <= n; i++) {
factorials.push(sum * i);
}
}
return factorials[n];
};
/**
* Increments a number with a wrapping to a minimum value if the number exceeds the maximum value.
*
* @memberof CesiumMath
*
* @param {Number} [n] The number to be incremented.
* @param {Number} [maximumValue] The maximum incremented value before rolling over to the minimum value.
* @param {Number} [minimumValue=0.0] The number reset to after the maximum value has been exceeded.
*
* @returns {Number} The incremented number.
*
* @example
* var n = CesiumMath.incrementWrap(5, 10, 0); // returns 6
* var n = CesiumMath.incrementWrap(10, 10, 0); // returns 0
*
* @exception {DeveloperError} Maximum value must be greater than minimum value.
*/
CesiumMath.incrementWrap = function(n, maximumValue, minimumValue) {
minimumValue = defaultValue(minimumValue, 0.0);
if (maximumValue <= minimumValue) {
throw new DeveloperError('Maximum value must be greater than minimum value.');
}
++n;
if (n > maximumValue) {
n = minimumValue;
}
return n;
};
/**
* Determines if a positive integer is a power of two.
*
* @memberof CesiumMath
*
* @param {Number} n The positive integer to test.
*
* @returns {Boolean} <code>true</code> if the number if a power of two; otherwise, <code>false</code>.
*
* @example
* var t = CesiumMath.isPowerOfTwo(16); // true
* var f = CesiumMath.isPowerOfTwo(20); // false
*
* @exception {DeveloperError} A number greater than or equal to 0 is required.
*/
CesiumMath.isPowerOfTwo = function(n) {
if (typeof n !== 'number' || n < 0) {
throw new DeveloperError('A number greater than or equal to 0 is required.');
}
var m = defaultValue(n, 0);
return (m !== 0) && ((m & (m - 1)) === 0);
};
/**
* Constraint a value to lie between two values.
*
* @memberof CesiumMath
*
* @param {Number} value The value to constrain.
* @param {Number} min The minimum value.
* @param {Number} max The maximum value.
* @returns The value clamped so that min <= value <= max.
*/
CesiumMath.clamp = function(value, min, max) {
return value < min ? min : value > max ? max : value;
};
var randomNumberGenerator = new MersenneTwister();
/**
* Sets the seed used by the random number generator
* in {@link CesiumMath#nextRandomNumber}.
*
* @memberof CesiumMath
*
* @param {Number} seed An integer used as the seed.
*
* @exception {DeveloperError} seed is required.
*/
CesiumMath.setRandomNumberSeed = function(seed) {
if (!defined(seed)) {
throw new DeveloperError('seed is required.');
}
randomNumberGenerator = new MersenneTwister(seed);
};
/**
* Generates a random number in the range of [0.0, 1.0)
* using a Mersenne twister.
*
* @memberof CesiumMath
*
* @returns A random number in the range of [0.0, 1.0).
*
* @see CesiumMath#setRandomNumberSeed
* @see http://en.wikipedia.org/wiki/Mersenne_twister
*/
CesiumMath.nextRandomNumber = function() {
return randomNumberGenerator.random();
};
return CesiumMath;
});
/*global define*/
define('Core/Cartographic',[
'./defaultValue',
'./defined',
'./DeveloperError',
'./freezeObject',
'./Math'
], function(
defaultValue,
defined,
DeveloperError,
freezeObject,
CesiumMath) {
"use strict";
/**
* A position defined by longitude, latitude, and height.
* @alias Cartographic
* @constructor
*
* @param {Number} [longitude=0.0] The longitude, in radians.
* @param {Number} [latitude=0.0] The latitude, in radians.
* @param {Number} [height=0.0] The height, in meters, above the ellipsoid.
*
* @see Ellipsoid
*/
var Cartographic = function(longitude, latitude, height) {
/**
* The longitude, in radians.
* @type {Number}
* @default 0.0
*/
this.longitude = defaultValue(longitude, 0.0);
/**
* The latitude, in radians.
* @type {Number}
* @default 0.0
*/
this.latitude = defaultValue(latitude, 0.0);
/**
* The height, in meters, above the ellipsoid.
* @type {Number}
* @default 0.0
*/
this.height = defaultValue(height, 0.0);
};
/**
* Creates a new Cartographic instance from longitude and latitude
* specified in degrees. The values in the resulting object will
* be in radians.
* @memberof Cartographic
*
* @param {Number} [longitude=0.0] The longitude, in degrees.
* @param {Number} [latitude=0.0] The latitude, in degrees.
* @param {Number} [height=0.0] The height, in meters, above the ellipsoid.
* @param {Cartographic} [result] The object onto which to store the result.
* @returns {Cartographic} The modified result parameter or a new Cartographic instance if one was not provided.
*/
Cartographic.fromDegrees = function(longitude, latitude, height, result) {
longitude = CesiumMath.toRadians(defaultValue(longitude, 0.0));
latitude = CesiumMath.toRadians(defaultValue(latitude, 0.0));
height = defaultValue(height, 0.0);
if (!defined(result)) {
return new Cartographic(longitude, latitude, height);
}
result.longitude = longitude;
result.latitude = latitude;
result.height = height;
return result;
};
/**
* Duplicates a Cartographic instance.
* @memberof Cartographic
*
* @param {Cartographic} cartographic The cartographic to duplicate.
* @param {Cartographic} [result] The object onto which to store the result.
* @returns {Cartographic} The modified result parameter or a new Cartographic instance if one was not provided. (Returns undefined if cartographic is undefined)
*/
Cartographic.clone = function(cartographic, result) {
if (!defined(cartographic)) {
return undefined;
}
if (!defined(result)) {
return new Cartographic(cartographic.longitude, cartographic.latitude, cartographic.height);
}
result.longitude = cartographic.longitude;
result.latitude = cartographic.latitude;
result.height = cartographic.height;
return result;
};
/**
* Compares the provided cartographics componentwise and returns
* <code>true</code> if they are equal, <code>false</code> otherwise.
* @memberof Cartographic
*
* @param {Cartographic} [left] The first cartographic.
* @param {Cartographic} [right] The second cartographic.
* @returns {Boolean} <code>true</code> if left and right are equal, <code>false</code> otherwise.
*/
Cartographic.equals = function(left, right) {
return (left === right) ||
((defined(left)) &&
(defined(right)) &&
(left.longitude === right.longitude) &&
(left.latitude === right.latitude) &&
(left.height === right.height));
};
/**
* Compares the provided cartographics componentwise and returns
* <code>true</code> if they are within the provided epsilon,
* <code>false</code> otherwise.
* @memberof Cartographic
*
* @param {Cartographic} [left] The first cartographic.
* @param {Cartographic} [right] The second cartographic.
* @param {Number} epsilon The epsilon to use for equality testing.
* @returns {Boolean} <code>true</code> if left and right are within the provided epsilon, <code>false</code> otherwise.
*
* @exception {DeveloperError} epsilon is required and must be a number.
*/
Cartographic.equalsEpsilon = function(left, right, epsilon) {
if (typeof epsilon !== 'number') {
throw new DeveloperError('epsilon is required and must be a number.');
}
return (left === right) ||
((defined(left)) &&
(defined(right)) &&
(Math.abs(left.longitude - right.longitude) <= epsilon) &&
(Math.abs(left.latitude - right.latitude) <= epsilon) &&
(Math.abs(left.height - right.height) <= epsilon));
};
/**
* Creates a string representing the provided cartographic in the format '(longitude, latitude, height)'.
* @memberof Cartographic
*
* @param {Cartographic} cartographic The cartographic to stringify.
* @returns {String} A string representing the provided cartographic in the format '(longitude, latitude, height)'.
*
* @exception {DeveloperError} cartographic is required.
*/
Cartographic.toString = function(cartographic) {
if (!defined(cartographic)) {
throw new DeveloperError('cartographic is required');
}
return '(' + cartographic.longitude + ', ' + cartographic.latitude + ', ' + cartographic.height + ')';
};
/**
* An immutable Cartographic instance initialized to (0.0, 0.0, 0.0).
*
* @memberof Cartographic
*/
Cartographic.ZERO = freezeObject(new Cartographic(0.0, 0.0, 0.0));
/**
* Duplicates this instance.
* @memberof Cartographic
*
* @param {Cartographic} [result] The object onto which to store the result.
* @returns {Cartographic} The modified result parameter or a new Cartographic instance if one was not provided.
*/
Cartographic.prototype.clone = function(result) {
return Cartographic.clone(this, result);
};
/**
* Compares the provided against this cartographic componentwise and returns
* <code>true</code> if they are equal, <code>false</code> otherwise.
* @memberof Cartographic
*
* @param {Cartographic} [right] The second cartographic.
* @returns {Boolean} <code>true</code> if left and right are equal, <code>false</code> otherwise.
*/
Cartographic.prototype.equals = function(right) {
return Cartographic.equals(this, right);
};
/**
* Compares the provided against this cartographic componentwise and returns
* <code>true</code> if they are within the provided epsilon,
* <code>false</code> otherwise.
* @memberof Cartographic
*
* @param {Cartographic} [right] The second cartographic.
* @param {Number} epsilon The epsilon to use for equality testing.
* @returns {Boolean} <code>true</code> if left and right are within the provided epsilon, <code>false</code> otherwise.
*
* @exception {DeveloperError} epsilon is required and must be a number.
*/
Cartographic.prototype.equalsEpsilon = function(right, epsilon) {
return Cartographic.equalsEpsilon(this, right, epsilon);
};
/**
* Creates a string representing this cartographic in the format '(longitude, latitude, height)'.
* @memberof Cartographic
*
* @returns {String} A string representing the provided cartographic in the format '(longitude, latitude, height)'.
*/
Cartographic.prototype.toString = function() {
return Cartographic.toString(this);
};
return Cartographic;
});
/*global define*/
define('Core/Ellipsoid',[
'./freezeObject',
'./defaultValue',
'./defined',
'./DeveloperError',
'./Math',
'./Cartesian3',
'./Cartographic'
], function(
freezeObject,
defaultValue,
defined,
DeveloperError,
CesiumMath,
Cartesian3,
Cartographic) {
"use strict";
/**
* A quadratic surface defined in Cartesian coordinates by the equation
* <code>(x / a)^2 + (y / b)^2 + (z / c)^2 = 1</code>. Primarily used
* by Cesium to represent the shape of planetary bodies.
*
* Rather than constructing this object directly, one of the provided
* constants is normally used.
* @alias Ellipsoid
* @constructor
* @immutable
*
* @param {Number} [x=0] The radius in the x direction.
* @param {Number} [y=0] The radius in the y direction.
* @param {Number} [z=0] The radius in the z direction.
*
* @exception {DeveloperError} All radii components must be greater than or equal to zero.
*
* @see Ellipsoid.fromCartesian3
* @see Ellipsoid.WGS84
* @see Ellipsoid.UNIT_SPHERE
*/
var Ellipsoid = function(x, y, z) {
x = defaultValue(x, 0.0);
y = defaultValue(y, 0.0);
z = defaultValue(z, 0.0);
if (x < 0.0 || y < 0.0 || z < 0.0) {
throw new DeveloperError('All radii components must be greater than or equal to zero.');
}
this._radii = new Cartesian3(x, y, z);
this._radiiSquared = new Cartesian3(x * x,
y * y,
z * z);
this._radiiToTheFourth = new Cartesian3(x * x * x * x,
y * y * y * y,
z * z * z * z);
this._oneOverRadii = new Cartesian3(x === 0.0 ? 0.0 : 1.0 / x,
y === 0.0 ? 0.0 : 1.0 / y,
z === 0.0 ? 0.0 : 1.0 / z);
this._oneOverRadiiSquared = new Cartesian3(x === 0.0 ? 0.0 : 1.0 / (x * x),
y === 0.0 ? 0.0 : 1.0 / (y * y),
z === 0.0 ? 0.0 : 1.0 / (z * z));
this._minimumRadius = Math.min(x, y, z);
this._maximumRadius = Math.max(x, y, z);
this._centerToleranceSquared = CesiumMath.EPSILON1;
};
/**
* Duplicates an Ellipsoid instance.
*
* @memberof Ellipsoid
*
* @param {Ellipsoid} ellipsoid The ellipsoid to duplicate.
* @param {Ellipsoid} [result] The object onto which to store the result, or undefined if a new
* instance should be created.
* @returns {Ellipsoid} The cloned Ellipsoid. (Returns undefined if ellipsoid is undefined)
*/
Ellipsoid.clone = function(ellipsoid, result) {
if (!defined(ellipsoid)) {
return undefined;
}
var radii = ellipsoid._radii;
if (!defined(result)) {
return new Ellipsoid(radii.x, radii.y, radii.z);
}
Cartesian3.clone(radii, result._radii);
Cartesian3.clone(ellipsoid._radiiSquared, result._radiiSquared);
Cartesian3.clone(ellipsoid._radiiToTheFourth, result._radiiToTheFourth);
Cartesian3.clone(ellipsoid._oneOverRadii, result._oneOverRadii);
Cartesian3.clone(ellipsoid._oneOverRadiiSquared, result._oneOverRadiiSquared);
result._minimumRadius = ellipsoid._minimumRadius;
result._maximumRadius = ellipsoid._maximumRadius;
result._centerToleranceSquared = ellipsoid._centerToleranceSquared;
return result;
};
/**
* Computes an Ellipsoid from a Cartesian specifying the radii in x, y, and z directions.
*
* @param {Cartesian3} [radii=Cartesian3.ZERO] The ellipsoid's radius in the x, y, and z directions.
* @returns {Ellipsoid} A new Ellipsoid instance.
*
* @exception {DeveloperError} All radii components must be greater than or equal to zero.
*
* @see Ellipsoid.WGS84
* @see Ellipsoid.UNIT_SPHERE
*/
Ellipsoid.fromCartesian3 = function(cartesian) {
if (!defined(cartesian)) {
return new Ellipsoid();
}
return new Ellipsoid(cartesian.x, cartesian.y, cartesian.z);
};
/**
* An Ellipsoid instance initialized to the WGS84 standard.
* @memberof Ellipsoid
*
* @see czm_getWgs84EllipsoidEC
*/
Ellipsoid.WGS84 = freezeObject(new Ellipsoid(6378137.0, 6378137.0, 6356752.3142451793));
/**
* An Ellipsoid instance initialized to radii of (1.0, 1.0, 1.0).
* @memberof Ellipsoid
*/
Ellipsoid.UNIT_SPHERE = freezeObject(new Ellipsoid(1.0, 1.0, 1.0));
/**
* @memberof Ellipsoid
* @returns {Cartesian3} The radii of the ellipsoid.
*/
Ellipsoid.prototype.getRadii = function() {
return this._radii;
};
/**
* @memberof Ellipsoid
* @returns {Cartesian3} The squared radii of the ellipsoid.
*/
Ellipsoid.prototype.getRadiiSquared = function() {
return this._radiiSquared;
};
/**
* @memberof Ellipsoid
* @returns {Cartesian3} The radii of the ellipsoid raised to the fourth power.
*/
Ellipsoid.prototype.getRadiiToTheFourth = function() {
return this._radiiToTheFourth;
};
/**
* @memberof Ellipsoid
* @returns {Cartesian3} One over the radii of the ellipsoid.
*/
Ellipsoid.prototype.getOneOverRadii = function() {
return this._oneOverRadii;
};
/**
* @memberof Ellipsoid
* @returns {Cartesian3} One over the squared radii of the ellipsoid.
*/
Ellipsoid.prototype.getOneOverRadiiSquared = function() {
return this._oneOverRadiiSquared;
};
/**
* @memberof Ellipsoid
* @returns {Cartesian3} The minimum radius of the ellipsoid.
*/
Ellipsoid.prototype.getMinimumRadius = function() {
return this._minimumRadius;
};
/**
* @memberof Ellipsoid
* @returns {Cartesian3} The maximum radius of the ellipsoid.
*/
Ellipsoid.prototype.getMaximumRadius = function() {
return this._maximumRadius;
};
/**
* Duplicates an Ellipsoid instance.
*
* @memberof Ellipsoid
*
* @param {Ellipsoid} [result] The object onto which to store the result, or undefined if a new
* instance should be created.
* @returns {Ellipsoid} The cloned Ellipsoid.
*/
Ellipsoid.prototype.clone = function(result) {
return Ellipsoid.clone(this, result);
};
/**
* Computes the unit vector directed from the center of this ellipsoid toward the provided Cartesian position.
* @memberof Ellipsoid
*
* @param {Cartesian3} cartesian The Cartesian for which to to determine the geocentric normal.
* @param {Cartesian3} [result] The object onto which to store the result.
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if none was provided.
*
* @exception {DeveloperError} cartesian is required.
*/
Ellipsoid.prototype.geocentricSurfaceNormal = Cartesian3.normalize;
/**
* Computes the normal of the plane tangent to the surface of the ellipsoid at the provided position.
* @memberof Ellipsoid
*
* @param {Cartographic} cartographic The cartographic position for which to to determine the geodetic normal.
* @param {Cartesian3} [result] The object onto which to store the result.
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if none was provided.
*
* @exception {DeveloperError} cartographic is required.
*/
Ellipsoid.prototype.geodeticSurfaceNormalCartographic = function(cartographic, result) {
if (!defined(cartographic)) {
throw new DeveloperError('cartographic is required.');
}
var longitude = cartographic.longitude;
var latitude = cartographic.latitude;
var cosLatitude = Math.cos(latitude);
var x = cosLatitude * Math.cos(longitude);
var y = cosLatitude * Math.sin(longitude);
var z = Math.sin(latitude);
if (!defined(result)) {
result = new Cartesian3();
}
result.x = x;
result.y = y;
result.z = z;
return Cartesian3.normalize(result, result);
};
/**
* Computes the normal of the plane tangent to the surface of the ellipsoid at the provided position.
* @memberof Ellipsoid
*
* @param {Cartesian3} cartesian The Cartesian position for which to to determine the surface normal.
* @param {Cartesian3} [result] The object onto which to store the result.
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if none was provided.
*
* @exception {DeveloperError} cartesian is required.
*/
Ellipsoid.prototype.geodeticSurfaceNormal = function(cartesian, result) {
result = Cartesian3.multiplyComponents(cartesian, this._oneOverRadiiSquared, result);
return Cartesian3.normalize(result, result);
};
var cartographicToCartesianNormal = new Cartesian3();
var cartographicToCartesianK = new Cartesian3();
/**
* Converts the provided cartographic to Cartesian representation.
* @memberof Ellipsoid
*
* @param {Cartographic} cartographic The cartographic position.
* @param {Cartesian3} [result] The object onto which to store the result.
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if none was provided.
*
* @exception {DeveloperError} cartographic is required.
*
* @example
* //Create a Cartographic and determine it's Cartesian representation on a WGS84 ellipsoid.
* var position = new Cartographic(Math.toRadians(21), Math.toRadians(78), 5000);
* var cartesianPosition = Ellipsoid.WGS84.cartographicToCartesian(position);
*/
Ellipsoid.prototype.cartographicToCartesian = function(cartographic, result) {
//`cartographic is required` is thrown from geodeticSurfaceNormalCartographic.
var n = cartographicToCartesianNormal;
var k = cartographicToCartesianK;
this.geodeticSurfaceNormalCartographic(cartographic, n);
Cartesian3.multiplyComponents(this._radiiSquared, n, k);
var gamma = Math.sqrt(Cartesian3.dot(n, k));
Cartesian3.divideByScalar(k, gamma, k);
Cartesian3.multiplyByScalar(n, cartographic.height, n);
return Cartesian3.add(k, n, result);
};
/**
* Converts the provided array of cartographics to an array of Cartesians.
* @memberof Ellipsoid
*
* @param {Array} cartographics An array of cartographic positions.
* @param {Array} [result] The object onto which to store the result.
* @returns {Array} The modified result parameter or a new Array instance if none was provided.
*
* @exception {DeveloperError} cartographics is required.
*
* @example
* //Convert an array of Cartographics and determine their Cartesian representation on a WGS84 ellipsoid.
* var positions = [new Cartographic(Math.toRadians(21), Math.toRadians(78), 0),
* new Cartographic(Math.toRadians(21.321), Math.toRadians(78.123), 100),
* new Cartographic(Math.toRadians(21.645), Math.toRadians(78.456), 250)
* var cartesianPositions = Ellipsoid.WGS84.cartographicArrayToCartesianArray(positions);
*/
Ellipsoid.prototype.cartographicArrayToCartesianArray = function(cartographics, result) {
if (!defined(cartographics)) {
throw new DeveloperError('cartographics is required.');
}
var length = cartographics.length;
if (!defined(result)) {
result = new Array(length);
} else {
result.length = length;
}
for ( var i = 0; i < length; i++) {
result[i] = this.cartographicToCartesian(cartographics[i], result[i]);
}
return result;
};
var cartesianToCartographicN = new Cartesian3();
var cartesianToCartographicP = new Cartesian3();
var cartesianToCartographicH = new Cartesian3();
/**
* Converts the provided cartesian to cartographic representation.
* The cartesian is undefined at the center of the ellipsoid.
* @memberof Ellipsoid
*
* @param {Cartesian3} cartesian The Cartesian position to convert to cartographic representation.
* @param {Cartographic} [result] The object onto which to store the result.
* @returns {Cartographic} The modified result parameter, new Cartographic instance if none was provided, or undefined if the cartesian is at the center of the ellipsoid.
*
* @exception {DeveloperError} cartesian is required.
*
* @example
* //Create a Cartesian and determine it's Cartographic representation on a WGS84 ellipsoid.
* var position = new Cartesian(17832.12, 83234.52, 952313.73);
* var cartographicPosition = Ellipsoid.WGS84.cartesianToCartographic(position);
*/
Ellipsoid.prototype.cartesianToCartographic = function(cartesian, result) {
//`cartesian is required.` is thrown from scaleToGeodeticSurface
var p = this.scaleToGeodeticSurface(cartesian, cartesianToCartographicP);
if (!defined(p)) {
return undefined;
}
var n = this.geodeticSurfaceNormal(p, cartesianToCartographicN);
var h = Cartesian3.subtract(cartesian, p, cartesianToCartographicH);
var longitude = Math.atan2(n.y, n.x);
var latitude = Math.asin(n.z);
var height = CesiumMath.sign(Cartesian3.dot(h, cartesian)) * Cartesian3.magnitude(h);
if (!defined(result)) {
return new Cartographic(longitude, latitude, height);
}
result.longitude = longitude;
result.latitude = latitude;
result.height = height;
return result;
};
/**
* Converts the provided array of cartesians to an array of cartographics.
* @memberof Ellipsoid
*
* @param {Array} cartesians An array of Cartesian positions.
* @param {Array} [result] The object onto which to store the result.
* @returns {Array} The modified result parameter or a new Array instance if none was provided.
*
* @exception {DeveloperError} cartesians is required.
*
* @example
* //Create an array of Cartesians and determine their Cartographic representation on a WGS84 ellipsoid.
* var positions = [new Cartesian(17832.12, 83234.52, 952313.73),
* new Cartesian(17832.13, 83234.53, 952313.73),
* new Cartesian(17832.14, 83234.54, 952313.73)]
* var cartographicPositions = Ellipsoid.WGS84.cartesianArrayToCartographicArray(positions);
*/
Ellipsoid.prototype.cartesianArrayToCartographicArray = function(cartesians, result) {
if (!defined(cartesians)) {
throw new DeveloperError('cartesians is required.');
}
var length = cartesians.length;
if (!defined(result)) {
result = new Array(length);
} else {
result.length = length;
}
for ( var i = 0; i < length; ++i) {
result[i] = this.cartesianToCartographic(cartesians[i], result[i]);
}
return result;
};
var scaleToGeodeticSurfaceIntersection;
var scaleToGeodeticSurfaceGradient = new Cartesian3();
/**
* Scales the provided Cartesian position along the geodetic surface normal
* so that it is on the surface of this ellipsoid. If the position is
* at the center of the ellipsoid, this function returns undefined.
* @memberof Ellipsoid
*
* @param {Cartesian3} cartesian The Cartesian position to scale.
* @param {Cartesian3} [result] The object onto which to store the result.
* @returns {Cartesian3} The modified result parameter, a new Cartesian3 instance if none was provided, or undefined if the position is at the center.
*
* @exception {DeveloperError} cartesian is required.
*/
Ellipsoid.prototype.scaleToGeodeticSurface = function(cartesian, result) {
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required.');
}
var positionX = cartesian.x;
var positionY = cartesian.y;
var positionZ = cartesian.z;
var oneOverRadii = this._oneOverRadii;
var oneOverRadiiX = oneOverRadii.x;
var oneOverRadiiY = oneOverRadii.y;
var oneOverRadiiZ = oneOverRadii.z;
var x2 = positionX * positionX * oneOverRadiiX * oneOverRadiiX;
var y2 = positionY * positionY * oneOverRadiiY * oneOverRadiiY;
var z2 = positionZ * positionZ * oneOverRadiiZ * oneOverRadiiZ;
// Compute the squared ellipsoid norm.
var squaredNorm = x2 + y2 + z2;
var ratio = Math.sqrt(1.0 / squaredNorm);
// As an initial approximation, assume that the radial intersection is the projection point.
var intersection = Cartesian3.multiplyByScalar(cartesian, ratio, scaleToGeodeticSurfaceIntersection);
//* If the position is near the center, the iteration will not converge.
if (squaredNorm < this._centerToleranceSquared) {
return !isFinite(ratio) ? undefined : Cartesian3.clone(intersection, result);
}
var oneOverRadiiSquared = this._oneOverRadiiSquared;
var oneOverRadiiSquaredX = oneOverRadiiSquared.x;
var oneOverRadiiSquaredY = oneOverRadiiSquared.y;
var oneOverRadiiSquaredZ = oneOverRadiiSquared.z;
// Use the gradient at the intersection point in place of the true unit normal.
// The difference in magnitude will be absorbed in the multiplier.
var gradient = scaleToGeodeticSurfaceGradient;
gradient.x = intersection.x * oneOverRadiiSquaredX * 2.0;
gradient.y = intersection.y * oneOverRadiiSquaredY * 2.0;
gradient.z = intersection.z * oneOverRadiiSquaredZ * 2.0;
// Compute the initial guess at the normal vector multiplier, lambda.
var lambda = (1.0 - ratio) * Cartesian3.magnitude(cartesian) / (0.5 * Cartesian3.magnitude(gradient));
var correction = 0.0;
var func;
var denominator;
var xMultiplier;
var yMultiplier;
var zMultiplier;
var xMultiplier2;
var yMultiplier2;
var zMultiplier2;
var xMultiplier3;
var yMultiplier3;
var zMultiplier3;
do {
lambda -= correction;
xMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredX);
yMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredY);
zMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredZ);
xMultiplier2 = xMultiplier * xMultiplier;
yMultiplier2 = yMultiplier * yMultiplier;
zMultiplier2 = zMultiplier * zMultiplier;
xMultiplier3 = xMultiplier2 * xMultiplier;
yMultiplier3 = yMultiplier2 * yMultiplier;
zMultiplier3 = zMultiplier2 * zMultiplier;
func = x2 * xMultiplier2 + y2 * yMultiplier2 + z2 * zMultiplier2 - 1.0;
// "denominator" here refers to the use of this expression in the velocity and acceleration
// computations in the sections to follow.
denominator = x2 * xMultiplier3 * oneOverRadiiSquaredX + y2 * yMultiplier3 * oneOverRadiiSquaredY + z2 * zMultiplier3 * oneOverRadiiSquaredZ;
var derivative = -2.0 * denominator;
correction = func / derivative;
} while (Math.abs(func) > CesiumMath.EPSILON12);
if (!defined(result)) {
return new Cartesian3(positionX * xMultiplier, positionY * yMultiplier, positionZ * zMultiplier);
}
result.x = positionX * xMultiplier;
result.y = positionY * yMultiplier;
result.z = positionZ * zMultiplier;
return result;
};
/**
* Scales the provided Cartesian position along the geocentric surface normal
* so that it is on the surface of this ellipsoid.
* @memberof Ellipsoid
*
* @param {Cartesian3} cartesian The Cartesian position to scale.
* @param {Cartesian3} [result] The object onto which to store the result.
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if none was provided.
*
* @exception {DeveloperError} cartesian is required.
*/
Ellipsoid.prototype.scaleToGeocentricSurface = function(cartesian, result) {
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required.');
}
var positionX = cartesian.x;
var positionY = cartesian.y;
var positionZ = cartesian.z;
var oneOverRadiiSquared = this._oneOverRadiiSquared;
var beta = 1.0 / Math.sqrt((positionX * positionX) * oneOverRadiiSquared.x +
(positionY * positionY) * oneOverRadiiSquared.y +
(positionZ * positionZ) * oneOverRadiiSquared.z);
return Cartesian3.multiplyByScalar(cartesian, beta, result);
};
/**
* Transforms a Cartesian X, Y, Z position to the ellipsoid-scaled space by multiplying
* its components by the result of {@link Ellipsoid#getOneOverRadii}.
*
* @memberof Ellipsoid
*
* @param {Cartesian3} position The position to transform.
* @param {Cartesian3} [result] The position to which to copy the result, or undefined to create and
* return a new instance.
* @returns {Cartesian3} The position expressed in the scaled space. The returned instance is the
* one passed as the result parameter if it is not undefined, or a new instance of it is.
*/
Ellipsoid.prototype.transformPositionToScaledSpace = function(position, result) {
return Cartesian3.multiplyComponents(position, this._oneOverRadii, result);
};
/**
* Compares this Ellipsoid against the provided Ellipsoid componentwise and returns
* <code>true</code> if they are equal, <code>false</code> otherwise.
* @memberof Ellipsoid
*
* @param {Ellipsoid} [right] The other Ellipsoid.
* @returns {Boolean} <code>true</code> if they are equal, <code>false</code> otherwise.
*/
Ellipsoid.prototype.equals = function(right) {
return (this === right) ||
(defined(right) &&
Cartesian3.equals(this._radii, right._radii));
};
/**
* Creates a string representing this Ellipsoid in the format '(radii.x, radii.y, radii.z)'.
* @memberof Ellipsoid
*
* @returns {String} A string representing this ellipsoid in the format '(radii.x, radii.y, radii.z)'.
*/
Ellipsoid.prototype.toString = function() {
return this._radii.toString();
};
return Ellipsoid;
});
/*global define*/
define('Core/GeographicProjection',[
'./defaultValue',
'./defined',
'./Cartesian3',
'./Cartographic',
'./Ellipsoid'
], function(
defaultValue,
defined,
Cartesian3,
Cartographic,
Ellipsoid) {
"use strict";
/**
* A simple map projection where longitude and latitude are linearly mapped to X and Y by multiplying
* them by the {@link Ellipsoid#getMaximumRadius}. This projection
* is commonly known as geographic, equirectangular, equidistant cylindrical, or plate carr??e. It
* is also known as EPSG:4326.
*
* @alias GeographicProjection
* @constructor
* @immutable
*
* @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid.
*
* @see WebMercatorProjection
*/
var GeographicProjection = function(ellipsoid) {
this._ellipsoid = defaultValue(ellipsoid, Ellipsoid.WGS84);
this._semimajorAxis = this._ellipsoid.getMaximumRadius();
this._oneOverSemimajorAxis = 1.0 / this._semimajorAxis;
};
/**
* Gets the {@link Ellipsoid}.
*
* @memberof GeographicProjection
*
* @returns {Ellipsoid} The ellipsoid.
*/
GeographicProjection.prototype.getEllipsoid = function() {
return this._ellipsoid;
};
/**
* Projects a set of {@link Cartographic} coordinates, in radians, to map coordinates, in meters.
* X and Y are the longitude and latitude, respectively, multiplied by the maximum radius of the
* ellipsoid. Z is the unmodified height.
*
* @memberof GeographicProjection
*
* @param {Cartographic} cartographic The coordinates to project.
* @param {Cartesian3} [result] An instance into which to copy the result. If this parameter is
* undefined, a new instance is created and returned.
* @returns {Cartesian3} The projected coordinates. If the result parameter is not undefined, the
* coordinates are copied there and that instance is returned. Otherwise, a new instance is
* created and returned.
*/
GeographicProjection.prototype.project = function(cartographic, result) {
// Actually this is the special case of equidistant cylindrical called the plate carree
var semimajorAxis = this._semimajorAxis;
var x = cartographic.longitude * semimajorAxis;
var y = cartographic.latitude * semimajorAxis;
var z = cartographic.height;
if (!defined(result)) {
return new Cartesian3(x, y, z);
}
result.x = x;
result.y = y;
result.z = z;
return result;
};
/**
* Unprojects a set of projected {@link Cartesian3} coordinates, in meters, to {@link Cartographic}
* coordinates, in radians. Longitude and Latitude are the X and Y coordinates, respectively,
* divided by the maximum radius of the ellipsoid. Height is the unmodified Z coordinate.
*
* @memberof GeographicProjection
*
* @param {Cartesian3} cartesian The coordinate to unproject.
* @param {Cartographic} [result] An instance into which to copy the result. If this parameter is
* undefined, a new instance is created and returned.
* @returns {Cartographic} The unprojected coordinates. If the result parameter is not undefined, the
* coordinates are copied there and that instance is returned. Otherwise, a new instance is
* created and returned.
*/
GeographicProjection.prototype.unproject = function(cartesian, result) {
var oneOverEarthSemimajorAxis = this._oneOverSemimajorAxis;
var longitude = cartesian.x * oneOverEarthSemimajorAxis;
var latitude = cartesian.y * oneOverEarthSemimajorAxis;
var height = cartesian.z;
if (!defined(result)) {
return new Cartographic(longitude, latitude, height);
}
result.longitude = longitude;
result.latitude = latitude;
result.height = height;
return result;
};
return GeographicProjection;
});
/*global define*/
define('Core/Intersect',['./Enumeration'], function(Enumeration) {
"use strict";
/**
* This enumerated type is used in determining where, relative to the frustum, an
* object is located. The object can either be fully contained within the frustum (INSIDE),
* partially inside the frustum and partially outside (INTERSECTING), or somwhere entirely
* outside of the frustum's 6 planes (OUTSIDE).
*
* @exports Intersect
*/
var Intersect = {
/**
* Represents that an object is not contained within the frustum.
*
* @type {Enumeration}
* @constant
* @default -1
*/
OUTSIDE : new Enumeration(-1, 'OUTSIDE'),
/**
* Represents that an object intersects one of the frustum's planes.
*
* @type {Enumeration}
* @constant
* @default 0
*/
INTERSECTING : new Enumeration(0, 'INTERSECTING'),
/**
* Represents that an object is fully within the frustum.
*
* @type {Enumeration}
* @constant
* @default 1
*/
INSIDE : new Enumeration(1, 'INSIDE')
};
return Intersect;
});
/*global define*/
define('Core/Interval',['./defaultValue'], function(defaultValue) {
"use strict";
/**
* Represents the closed interval [start, stop].
* @alias Interval
* @constructor
*
* @param {Number} [start=0.0] The beginning of the interval.
* @param {Number} [stop=0.0] The end of the interval.
*/
var Interval = function(start, stop) {
/**
* The beginning of the interval.
* @type {Number}
* @default 0.0
*/
this.start = defaultValue(start, 0.0);
/**
* The end of the interval.
* @type {Number}
* @default 0.0
*/
this.stop = defaultValue(stop, 0.0);
};
return Interval;
});
/*global define*/
define('Core/Matrix3',[
'./Cartesian3',
'./defaultValue',
'./defined',
'./DeveloperError',
'./freezeObject'
], function(
Cartesian3,
defaultValue,
defined,
DeveloperError,
freezeObject) {
"use strict";
/**
* A 3x3 matrix, indexable as a column-major order array.
* Constructor parameters are in row-major order for code readability.
* @alias Matrix3
* @constructor
*
* @param {Number} [column0Row0=0.0] The value for column 0, row 0.
* @param {Number} [column1Row0=0.0] The value for column 1, row 0.
* @param {Number} [column2Row0=0.0] The value for column 2, row 0.
* @param {Number} [column0Row1=0.0] The value for column 0, row 1.
* @param {Number} [column1Row1=0.0] The value for column 1, row 1.
* @param {Number} [column2Row1=0.0] The value for column 2, row 1.
* @param {Number} [column0Row2=0.0] The value for column 0, row 2.
* @param {Number} [column1Row2=0.0] The value for column 1, row 2.
* @param {Number} [column2Row2=0.0] The value for column 2, row 2.
*
* @see Matrix3.fromColumnMajor
* @see Matrix3.fromRowMajorArray
* @see Matrix3.fromQuaternion
* @see Matrix3.fromScale
* @see Matrix3.fromUniformScale
* @see Matrix2
* @see Matrix4
*/
var Matrix3 = function(column0Row0, column1Row0, column2Row0,
column0Row1, column1Row1, column2Row1,
column0Row2, column1Row2, column2Row2) {
this[0] = defaultValue(column0Row0, 0.0);
this[1] = defaultValue(column0Row1, 0.0);
this[2] = defaultValue(column0Row2, 0.0);
this[3] = defaultValue(column1Row0, 0.0);
this[4] = defaultValue(column1Row1, 0.0);
this[5] = defaultValue(column1Row2, 0.0);
this[6] = defaultValue(column2Row0, 0.0);
this[7] = defaultValue(column2Row1, 0.0);
this[8] = defaultValue(column2Row2, 0.0);
};
/**
* Duplicates a Matrix3 instance.
* @memberof Matrix3
*
* @param {Matrix3} matrix The matrix to duplicate.
* @param {Matrix3} [result] The object onto which to store the result.
* @returns {Matrix3} The modified result parameter or a new Matrix3 instance if one was not provided. (Returns undefined if matrix is undefined)
*/
Matrix3.clone = function(values, result) {
if (!defined(values)) {
return undefined;
}
if (!defined(result)) {
return new Matrix3(values[0], values[3], values[6],
values[1], values[4], values[7],
values[2], values[5], values[8]);
}
result[0] = values[0];
result[1] = values[1];
result[2] = values[2];
result[3] = values[3];
result[4] = values[4];
result[5] = values[5];
result[6] = values[6];
result[7] = values[7];
result[8] = values[8];
return result;
};
/**
* Creates a Matrix3 instance from a column-major order array.
* @memberof Matrix3
* @function
*
* @param {Array} values The column-major order array.
* @param {Matrix3} [result] The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix3 instance if one was not provided.
*
* @exception {DeveloperError} values is required.
*/
Matrix3.fromColumnMajorArray = function(values, result) {
if (!defined(values)) {
throw new DeveloperError('values parameter is required');
}
return Matrix3.clone(values, result);
};
/**
* Creates a Matrix3 instance from a row-major order array.
* The resulting matrix will be in column-major order.
* @memberof Matrix3
*
* @param {Array} values The row-major order array.
* @param {Matrix3} [result] The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix3 instance if one was not provided.
*
* @exception {DeveloperError} values is required.
*/
Matrix3.fromRowMajorArray = function(values, result) {
if (!defined(values)) {
throw new DeveloperError('values is required.');
}
if (!defined(result)) {
return new Matrix3(values[0], values[1], values[2],
values[3], values[4], values[5],
values[6], values[7], values[8]);
}
result[0] = values[0];
result[1] = values[3];
result[2] = values[6];
result[3] = values[1];
result[4] = values[4];
result[5] = values[7];
result[6] = values[2];
result[7] = values[5];
result[8] = values[8];
return result;
};
/**
* Computes a 3x3 rotation matrix from the provided quaternion.
* @memberof Matrix3
*
* @param {Quaternion} quaternion the quaternion to use.
*
* @returns {Matrix3} The 3x3 rotation matrix from this quaternion.
*/
Matrix3.fromQuaternion = function(quaternion, result) {
if (!defined(quaternion)) {
throw new DeveloperError('quaternion is required');
}
var x2 = quaternion.x * quaternion.x;
var xy = quaternion.x * quaternion.y;
var xz = quaternion.x * quaternion.z;
var xw = quaternion.x * quaternion.w;
var y2 = quaternion.y * quaternion.y;
var yz = quaternion.y * quaternion.z;
var yw = quaternion.y * quaternion.w;
var z2 = quaternion.z * quaternion.z;
var zw = quaternion.z * quaternion.w;
var w2 = quaternion.w * quaternion.w;
var m00 = x2 - y2 - z2 + w2;
var m01 = 2.0 * (xy + zw);
var m02 = 2.0 * (xz - yw);
var m10 = 2.0 * (xy - zw);
var m11 = -x2 + y2 - z2 + w2;
var m12 = 2.0 * (yz + xw);
var m20 = 2.0 * (xz + yw);
var m21 = 2.0 * (yz - xw);
var m22 = -x2 - y2 + z2 + w2;
if (!defined(result)) {
return new Matrix3(m00, m01, m02,
m10, m11, m12,
m20, m21, m22);
}
result[0] = m00;
result[1] = m10;
result[2] = m20;
result[3] = m01;
result[4] = m11;
result[5] = m21;
result[6] = m02;
result[7] = m12;
result[8] = m22;
return result;
};
/**
* Computes a Matrix3 instance representing a non-uniform scale.
* @memberof Matrix3
*
* @param {Cartesian3} scale The x, y, and z scale factors.
* @param {Matrix3} [result] The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix3 instance if one was not provided.
*
* @exception {DeveloperError} scale is required.
*
* @example
* // Creates
* // [7.0, 0.0, 0.0]
* // [0.0, 8.0, 0.0]
* // [0.0, 0.0, 9.0]
* var m = Matrix3.fromScale(new Cartesian3(7.0, 8.0, 9.0));
*/
Matrix3.fromScale = function(scale, result) {
if (!defined(scale)) {
throw new DeveloperError('scale is required.');
}
if (!defined(result)) {
return new Matrix3(
scale.x, 0.0, 0.0,
0.0, scale.y, 0.0,
0.0, 0.0, scale.z);
}
result[0] = scale.x;
result[1] = 0.0;
result[2] = 0.0;
result[3] = 0.0;
result[4] = scale.y;
result[5] = 0.0;
result[6] = 0.0;
result[7] = 0.0;
result[8] = scale.z;
return result;
};
/**
* Computes a Matrix3 instance representing a uniform scale.
* @memberof Matrix3
*
* @param {Number} scale The uniform scale factor.
* @param {Matrix3} [result] The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix3 instance if one was not provided.
*
* @exception {DeveloperError} scale is required.
*
* @example
* // Creates
* // [2.0, 0.0, 0.0]
* // [0.0, 2.0, 0.0]
* // [0.0, 0.0, 2.0]
* var m = Matrix3.fromUniformScale(2.0);
*/
Matrix3.fromUniformScale = function(scale, result) {
if (typeof scale !== 'number') {
throw new DeveloperError('scale is required.');
}
if (!defined(result)) {
return new Matrix3(
scale, 0.0, 0.0,
0.0, scale, 0.0,
0.0, 0.0, scale);
}
result[0] = scale;
result[1] = 0.0;
result[2] = 0.0;
result[3] = 0.0;
result[4] = scale;
result[5] = 0.0;
result[6] = 0.0;
result[7] = 0.0;
result[8] = scale;
return result;
};
/**
* Creates a rotation matrix around the x-axis.
*
* @param {Number} angle The angle, in radians, of the rotation. Positive angles are counterclockwise.
* @param {Matrix3} [result] The object in which the result will be stored, if undefined a new instance will be created.
*
* @returns The modified result parameter, or a new Matrix3 instance if one was not provided.
*
* @exception {DeveloperError} angle is required.
*
* @example
* // Rotate a point 45 degrees counterclockwise around the x-axis.
* var p = new Cartesian3(5, 6, 7);
* var m = Matrix3.fromRotationX(CesiumMath.toRadians(45.0));
* var rotated = m.multiplyByVector(p);
*/
Matrix3.fromRotationX = function(angle, result) {
if (!defined(angle)) {
throw new DeveloperError('angle is required.');
}
var cosAngle = Math.cos(angle);
var sinAngle = Math.sin(angle);
if (!defined(result)) {
return new Matrix3(
1.0, 0.0, 0.0,
0.0, cosAngle, -sinAngle,
0.0, sinAngle, cosAngle);
}
result[0] = 1.0;
result[1] = 0.0;
result[2] = 0.0;
result[3] = 0.0;
result[4] = cosAngle;
result[5] = sinAngle;
result[6] = 0.0;
result[7] = -sinAngle;
result[8] = cosAngle;
return result;
};
/**
* Creates a rotation matrix around the y-axis.
*
* @param {Number} angle The angle, in radians, of the rotation. Positive angles are counterclockwise.
* @param {Matrix3} [result] The object in which the result will be stored, if undefined a new instance will be created.
*
* @returns The modified result parameter, or a new Matrix3 instance if one was not provided.
*
* @exception {DeveloperError} angle is required.
*
* @example
* // Rotate a point 45 degrees counterclockwise around the y-axis.
* var p = new Cartesian3(5, 6, 7);
* var m = Matrix3.fromRotationY(CesiumMath.toRadians(45.0));
* var rotated = m.multiplyByVector(p);
*/
Matrix3.fromRotationY = function(angle, result) {
if (!defined(angle)) {
throw new DeveloperError('angle is required.');
}
var cosAngle = Math.cos(angle);
var sinAngle = Math.sin(angle);
if (!defined(result)) {
return new Matrix3(
cosAngle, 0.0, sinAngle,
0.0, 1.0, 0.0,
-sinAngle, 0.0, cosAngle);
}
result[0] = cosAngle;
result[1] = 0.0;
result[2] = -sinAngle;
result[3] = 0.0;
result[4] = 1.0;
result[5] = 0.0;
result[6] = sinAngle;
result[7] = 0.0;
result[8] = cosAngle;
return result;
};
/**
* Creates a rotation matrix around the z-axis.
*
* @param {Number} angle The angle, in radians, of the rotation. Positive angles are counterclockwise.
* @param {Matrix3} [result] The object in which the result will be stored, if undefined a new instance will be created.
*
* @returns The modified result parameter, or a new Matrix3 instance if one was not provided.
*
* @exception {DeveloperError} angle is required.
*
* @example
* // Rotate a point 45 degrees counterclockwise around the z-axis.
* var p = new Cartesian3(5, 6, 7);
* var m = Matrix3.fromRotationZ(CesiumMath.toRadians(45.0));
* var rotated = m.multiplyByVector(p);
*/
Matrix3.fromRotationZ = function(angle, result) {
if (!defined(angle)) {
throw new DeveloperError('angle is required.');
}
var cosAngle = Math.cos(angle);
var sinAngle = Math.sin(angle);
if (!defined(result)) {
return new Matrix3(
cosAngle, -sinAngle, 0.0,
sinAngle, cosAngle, 0.0,
0.0, 0.0, 1.0);
}
result[0] = cosAngle;
result[1] = sinAngle;
result[2] = 0.0;
result[3] = -sinAngle;
result[4] = cosAngle;
result[5] = 0.0;
result[6] = 0.0;
result[7] = 0.0;
result[8] = 1.0;
return result;
};
/**
* Creates an Array from the provided Matrix3 instance.
* The array will be in column-major order.
* @memberof Matrix3
*
* @param {Matrix3} matrix The matrix to use..
* @param {Array} [result] The Array onto which to store the result.
* @returns {Array} The modified Array parameter or a new Array instance if one was not provided.
*
* @exception {DeveloperError} matrix is required.
*/
Matrix3.toArray = function(matrix, result) {
if (!defined(matrix)) {
throw new DeveloperError('matrix is required');
}
if (!defined(result)) {
return [matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5], matrix[6], matrix[7], matrix[8]];
}
result[0] = matrix[0];
result[1] = matrix[1];
result[2] = matrix[2];
result[3] = matrix[3];
result[4] = matrix[4];
result[5] = matrix[5];
result[6] = matrix[6];
result[7] = matrix[7];
result[8] = matrix[8];
return result;
};
/**
* Computes the array index of the element at the provided row and column.
* @memberof Matrix3
*
* @param {Number} row The zero-based index of the row.
* @param {Number} column The zero-based index of the column.
* @returns {Number} The index of the element at the provided row and column.
*
* @exception {DeveloperError} row is required and must be 0, 1, or 2.
* @exception {DeveloperError} column is required and must be 0, 1, or 2.
*
* @example
* var myMatrix = new Matrix3();
* var column1Row0Index = Matrix3.getElementIndex(1, 0);
* var column1Row0 = myMatrix[column1Row0Index]
* myMatrix[column1Row0Index] = 10.0;
*/
Matrix3.getElementIndex = function(column, row) {
if (typeof row !== 'number' || row < 0 || row > 2) {
throw new DeveloperError('row is required and must be 0, 1, or 2.');
}
if (typeof column !== 'number' || column < 0 || column > 2) {
throw new DeveloperError('column is required and must be 0, 1, or 2.');
}
return column * 3 + row;
};
/**
* Retrieves a copy of the matrix column at the provided index as a Cartesian3 instance.
* @memberof Matrix3
*
* @param {Matrix3} matrix The matrix to use.
* @param {Number} index The zero-based index of the column to retrieve.
* @param {Cartesian3} [result] The object onto which to store the result.
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided.
*
* @exception {DeveloperError} matrix is required.
* @exception {DeveloperError} index is required and must be 0, 1, or 2.
*
* @see Cartesian3
*/
Matrix3.getColumn = function(matrix, index, result) {
if (!defined(matrix)) {
throw new DeveloperError('matrix is required.');
}
if (typeof index !== 'number' || index < 0 || index > 2) {
throw new DeveloperError('index is required and must be 0, 1, or 2.');
}
var startIndex = index * 3;
var x = matrix[startIndex];
var y = matrix[startIndex + 1];
var z = matrix[startIndex + 2];
if (!defined(result)) {
return new Cartesian3(x, y, z);
}
result.x = x;
result.y = y;
result.z = z;
return result;
};
/**
* Computes a new matrix that replaces the specified column in the provided matrix with the provided Cartesian3 instance.
* @memberof Matrix3
*
* @param {Matrix3} matrix The matrix to use.
* @param {Number} index The zero-based index of the column to set.
* @param {Cartesian3} cartesian The Cartesian whose values will be assigned to the specified column.
* @param {Cartesian3} [result] The object onto which to store the result.
* @returns {Matrix3} The modified result parameter or a new Matrix3 instance if one was not provided.
*
* @exception {DeveloperError} matrix is required.
* @exception {DeveloperError} cartesian is required.
* @exception {DeveloperError} index is required and must be 0, 1, or 2.
*
* @see Cartesian3
*/
Matrix3.setColumn = function(matrix, index, cartesian, result) {
if (!defined(matrix)) {
throw new DeveloperError('matrix is required');
}
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required');
}
if (typeof index !== 'number' || index < 0 || index > 2) {
throw new DeveloperError('index is required and must be 0, 1, or 2.');
}
result = Matrix3.clone(matrix, result);
var startIndex = index * 3;
result[startIndex] = cartesian.x;
result[startIndex + 1] = cartesian.y;
result[startIndex + 2] = cartesian.z;
return result;
};
/**
* Retrieves a copy of the matrix row at the provided index as a Cartesian3 instance.
* @memberof Matrix3
*
* @param {Matrix3} matrix The matrix to use.
* @param {Number} index The zero-based index of the row to retrieve.
* @param {Cartesian3} [result] The object onto which to store the result.
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided.
*
* @exception {DeveloperError} matrix is required.
* @exception {DeveloperError} index is required and must be 0, 1, or 2.
*
* @see Cartesian3
*/
Matrix3.getRow = function(matrix, index, result) {
if (!defined(matrix)) {
throw new DeveloperError('matrix is required.');
}
if (typeof index !== 'number' || index < 0 || index > 2) {
throw new DeveloperError('index is required and must be 0, 1, or 2.');
}
var x = matrix[index];
var y = matrix[index + 3];
var z = matrix[index + 6];
if (!defined(result)) {
return new Cartesian3(x, y, z);
}
result.x = x;
result.y = y;
result.z = z;
return result;
};
/**
* Computes a new matrix that replaces the specified row in the provided matrix with the provided Cartesian3 instance.
* @memberof Matrix3
*
* @param {Matrix3} matrix The matrix to use.
* @param {Number} index The zero-based index of the row to set.
* @param {Cartesian3} cartesian The Cartesian whose values will be assigned to the specified row.
* @param {Cartesian3} [result] The object onto which to store the result.
* @returns {Matrix3} The modified result parameter or a new Matrix3 instance if one was not provided.
*
* @exception {DeveloperError} matrix is required.
* @exception {DeveloperError} cartesian is required.
* @exception {DeveloperError} index is required and must be 0, 1, or 2.
*
* @see Cartesian3
*/
Matrix3.setRow = function(matrix, index, cartesian, result) {
if (!defined(matrix)) {
throw new DeveloperError('matrix is required');
}
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required');
}
if (typeof index !== 'number' || index < 0 || index > 2) {
throw new DeveloperError('index is required and must be 0, 1, or 2.');
}
result = Matrix3.clone(matrix, result);
result[index] = cartesian.x;
result[index + 3] = cartesian.y;
result[index + 6] = cartesian.z;
return result;
};
/**
* Computes the product of two matrices.
* @memberof Matrix3
*
* @param {Matrix3} left The first matrix.
* @param {Matrix3} right The second matrix.
* @param {Matrix3} [result] The object onto which to store the result.
* @returns {Matrix3} The modified result parameter or a new Matrix3 instance if one was not provided.
*
* @exception {DeveloperError} left is required.
* @exception {DeveloperError} right is required.
*/
Matrix3.multiply = function(left, right, result) {
if (!defined(left)) {
throw new DeveloperError('left is required');
}
if (!defined(right)) {
throw new DeveloperError('right is required');
}
var column0Row0 = left[0] * right[0] + left[3] * right[1] + left[6] * right[2];
var column0Row1 = left[1] * right[0] + left[4] * right[1] + left[7] * right[2];
var column0Row2 = left[2] * right[0] + left[5] * right[1] + left[8] * right[2];
var column1Row0 = left[0] * right[3] + left[3] * right[4] + left[6] * right[5];
var column1Row1 = left[1] * right[3] + left[4] * right[4] + left[7] * right[5];
var column1Row2 = left[2] * right[3] + left[5] * right[4] + left[8] * right[5];
var column2Row0 = left[0] * right[6] + left[3] * right[7] + left[6] * right[8];
var column2Row1 = left[1] * right[6] + left[4] * right[7] + left[7] * right[8];
var column2Row2 = left[2] * right[6] + left[5] * right[7] + left[8] * right[8];
if (!defined(result)) {
return new Matrix3(column0Row0, column1Row0, column2Row0,
column0Row1, column1Row1, column2Row1,
column0Row2, column1Row2, column2Row2);
}
result[0] = column0Row0;
result[1] = column0Row1;
result[2] = column0Row2;
result[3] = column1Row0;
result[4] = column1Row1;
result[5] = column1Row2;
result[6] = column2Row0;
result[7] = column2Row1;
result[8] = column2Row2;
return result;
};
/**
* Computes the product of a matrix and a column vector.
* @memberof Matrix3
*
* @param {Matrix3} matrix The matrix.
* @param {Cartesian3} cartesian The column.
* @param {Cartesian3} [result] The object onto which to store the result.
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided.
*
* @exception {DeveloperError} matrix is required.
* @exception {DeveloperError} cartesian is required.
*/
Matrix3.multiplyByVector = function(matrix, cartesian, result) {
if (!defined(matrix)) {
throw new DeveloperError('matrix is required');
}
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required');
}
var vX = cartesian.x;
var vY = cartesian.y;
var vZ = cartesian.z;
var x = matrix[0] * vX + matrix[3] * vY + matrix[6] * vZ;
var y = matrix[1] * vX + matrix[4] * vY + matrix[7] * vZ;
var z = matrix[2] * vX + matrix[5] * vY + matrix[8] * vZ;
if (!defined(result)) {
return new Cartesian3(x, y, z);
}
result.x = x;
result.y = y;
result.z = z;
return result;
};
/**
* Computes the product of a matrix and a scalar.
* @memberof Matrix3
*
* @param {Matrix3} matrix The matrix.
* @param {Number} scalar The number to multiply by.
* @param {Matrix3} [result] The object onto which to store the result.
* @returns {Matrix3} The modified result parameter or a new Cartesian3 instance if one was not provided.
*
* @exception {DeveloperError} matrix is required.
* @exception {DeveloperError} scalar is required and must be a number.
*/
Matrix3.multiplyByScalar = function(matrix, scalar, result) {
if (!defined(matrix)) {
throw new DeveloperError('matrix is required');
}
if (typeof scalar !== 'number') {
throw new DeveloperError('scalar is required and must be a number');
}
if (!defined(result)) {
return new Matrix3(matrix[0] * scalar, matrix[3] * scalar, matrix[6] * scalar,
matrix[1] * scalar, matrix[4] * scalar, matrix[7] * scalar,
matrix[2] * scalar, matrix[5] * scalar, matrix[8] * scalar);
}
result[0] = matrix[0] * scalar;
result[1] = matrix[1] * scalar;
result[2] = matrix[2] * scalar;
result[3] = matrix[3] * scalar;
result[4] = matrix[4] * scalar;
result[5] = matrix[5] * scalar;
result[6] = matrix[6] * scalar;
result[7] = matrix[7] * scalar;
result[8] = matrix[8] * scalar;
return result;
};
/**
* Creates a negated copy of the provided matrix.
* @memberof Matrix3
*
* @param {Matrix3} matrix The matrix to negate.
* @param {Matrix3} [result] The object onto which to store the result.
* @returns {Matrix3} The modified result parameter or a new Matrix3 instance if one was not provided.
*
* @exception {DeveloperError} matrix is required.
*/
Matrix3.negate = function(matrix, result) {
if (!defined(matrix)) {
throw new DeveloperError('matrix is required');
}
if (!defined(result)) {
return new Matrix3(-matrix[0], -matrix[3], -matrix[6],
-matrix[1], -matrix[4], -matrix[7],
-matrix[2], -matrix[5], -matrix[8]);
}
result[0] = -matrix[0];
result[1] = -matrix[1];
result[2] = -matrix[2];
result[3] = -matrix[3];
result[4] = -matrix[4];
result[5] = -matrix[5];
result[6] = -matrix[6];
result[7] = -matrix[7];
result[8] = -matrix[8];
return result;
};
/**
* Computes the transpose of the provided matrix.
* @memberof Matrix3
*
* @param {Matrix3} matrix The matrix to transpose.
* @param {Matrix3} [result] The object onto which to store the result.
* @returns {Matrix3} The modified result parameter or a new Matrix3 instance if one was not provided.
*
* @exception {DeveloperError} matrix is required.
*/
Matrix3.transpose = function(matrix, result) {
if (!defined(matrix)) {
throw new DeveloperError('matrix is required');
}
var column0Row0 = matrix[0];
var column0Row1 = matrix[3];
var column0Row2 = matrix[6];
var column1Row0 = matrix[1];
var column1Row1 = matrix[4];
var column1Row2 = matrix[7];
var column2Row0 = matrix[2];
var column2Row1 = matrix[5];
var column2Row2 = matrix[8];
if (!defined(result)) {
return new Matrix3(column0Row0, column1Row0, column2Row0,
column0Row1, column1Row1, column2Row1,
column0Row2, column1Row2, column2Row2);
}
result[0] = column0Row0;
result[1] = column0Row1;
result[2] = column0Row2;
result[3] = column1Row0;
result[4] = column1Row1;
result[5] = column1Row2;
result[6] = column2Row0;
result[7] = column2Row1;
result[8] = column2Row2;
return result;
};
/**
* Compares the provided matrices componentwise and returns
* <code>true</code> if they are equal, <code>false</code> otherwise.
* @memberof Matrix3
*
* @param {Matrix3} [left] The first matrix.
* @param {Matrix3} [right] The second matrix.
* @returns {Boolean} <code>true</code> if left and right are equal, <code>false</code> otherwise.
*/
Matrix3.equals = function(left, right) {
return (left === right) ||
(defined(left) &&
defined(right) &&
left[0] === right[0] &&
left[1] === right[1] &&
left[2] === right[2] &&
left[3] === right[3] &&
left[4] === right[4] &&
left[5] === right[5] &&
left[6] === right[6] &&
left[7] === right[7] &&
left[8] === right[8]);
};
/**
* Compares the provided matrices componentwise and returns
* <code>true</code> if they are within the provided epsilon,
* <code>false</code> otherwise.
* @memberof Matrix3
*
* @param {Matrix3} [left] The first matrix.
* @param {Matrix3} [right] The second matrix.
* @param {Number} epsilon The epsilon to use for equality testing.
* @returns {Boolean} <code>true</code> if left and right are within the provided epsilon, <code>false</code> otherwise.
*
* @exception {DeveloperError} epsilon is required and must be a number.
*/
Matrix3.equalsEpsilon = function(left, right, epsilon) {
if (typeof epsilon !== 'number') {
throw new DeveloperError('epsilon is required and must be a number');
}
return (left === right) ||
(defined(left) &&
defined(right) &&
Math.abs(left[0] - right[0]) <= epsilon &&
Math.abs(left[1] - right[1]) <= epsilon &&
Math.abs(left[2] - right[2]) <= epsilon &&
Math.abs(left[3] - right[3]) <= epsilon &&
Math.abs(left[4] - right[4]) <= epsilon &&
Math.abs(left[5] - right[5]) <= epsilon &&
Math.abs(left[6] - right[6]) <= epsilon &&
Math.abs(left[7] - right[7]) <= epsilon &&
Math.abs(left[8] - right[8]) <= epsilon);
};
/**
* An immutable Matrix3 instance initialized to the identity matrix.
* @memberof Matrix3
*/
Matrix3.IDENTITY = freezeObject(new Matrix3(1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0));
/**
* The index into Matrix3 for column 0, row 0.
* @memberof Matrix3
*/
Matrix3.COLUMN0ROW0 = 0;
/**
* The index into Matrix3 for column 0, row 1.
* @memberof Matrix3
*/
Matrix3.COLUMN0ROW1 = 1;
/**
* The index into Matrix3 for column 0, row 2.
* @memberof Matrix3
*/
Matrix3.COLUMN0ROW2 = 2;
/**
* The index into Matrix3 for column 1, row 0.
* @memberof Matrix3
*/
Matrix3.COLUMN1ROW0 = 3;
/**
* The index into Matrix3 for column 1, row 1.
* @memberof Matrix3
*/
Matrix3.COLUMN1ROW1 = 4;
/**
* The index into Matrix3 for column 1, row 2.
* @memberof Matrix3
*/
Matrix3.COLUMN1ROW2 = 5;
/**
* The index into Matrix3 for column 2, row 0.
* @memberof Matrix3
*/
Matrix3.COLUMN2ROW0 = 6;
/**
* The index into Matrix3 for column 2, row 1.
* @memberof Matrix3
*/
Matrix3.COLUMN2ROW1 = 7;
/**
* The index into Matrix3 for column 2, row 2.
* @memberof Matrix3
*/
Matrix3.COLUMN2ROW2 = 8;
/**
* Duplicates the provided Matrix3 instance.
* @memberof Matrix3
*
* @param {Matrix3} [result] The object onto which to store the result.
* @returns {Matrix3} The modified result parameter or a new Matrix3 instance if one was not provided.
*/
Matrix3.prototype.clone = function(result) {
return Matrix3.clone(this, result);
};
/**
* Creates an Array from this Matrix3 instance.
* @memberof Matrix3
*
* @param {Array} [result] The Array onto which to store the result.
* @returns {Array} The modified Array parameter or a new Array instance if one was not provided.
*/
Matrix3.prototype.toArray = function(result) {
return Matrix3.toArray(this, result);
};
/**
* Retrieves a copy of the matrix column at the provided index as a Cartesian3 instance.
* @memberof Matrix3
*
* @param {Number} index The zero-based index of the column to retrieve.
* @param {Cartesian3} [result] The object onto which to store the result.
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided.
*
* @exception {DeveloperError} index is required and must be 0, 1, or 2.
*
* @see Cartesian3
*/
Matrix3.prototype.getColumn = function(index, result) {
return Matrix3.getColumn(this, index, result);
};
/**
* Computes a new matrix that replaces the specified column in this matrix with the provided Cartesian3 instance.
* @memberof Matrix3
*
* @param {Number} index The zero-based index of the column to set.
* @param {Cartesian3} cartesian The Cartesian whose values will be assigned to the specified column.
*
* @exception {DeveloperError} cartesian is required.
* @exception {DeveloperError} index is required and must be 0, 1, or 2.
*
* @see Cartesian3
*/
Matrix3.prototype.setColumn = function(index, cartesian, result) {
return Matrix3.setColumn(this, index, cartesian, result);
};
/**
* Retrieves a copy of the matrix row at the provided index as a Cartesian3 instance.
* @memberof Matrix3
*
* @param {Number} index The zero-based index of the row to retrieve.
* @param {Cartesian3} [result] The object onto which to store the result.
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided.
*
* @exception {DeveloperError} index is required and must be 0, 1, or 2.
*
* @see Cartesian3
*/
Matrix3.prototype.getRow = function(index, result) {
return Matrix3.getRow(this, index, result);
};
/**
* Computes a new matrix that replaces the specified row in this matrix with the provided Cartesian3 instance.
* @memberof Matrix3
*
* @param {Number} index The zero-based index of the row to set.
* @param {Cartesian3} cartesian The Cartesian whose values will be assigned to the specified row.
*
* @exception {DeveloperError} cartesian is required.
* @exception {DeveloperError} index is required and must be 0, 1, or 2.
*
* @see Cartesian3
*/
Matrix3.prototype.setRow = function(index, cartesian, result) {
return Matrix3.setRow(this, index, cartesian, result);
};
/**
* Computes the product of this matrix and the provided matrix.
* @memberof Matrix3
*
* @param {Matrix3} right The right hand side matrix.
* @param {Matrix3} [result] The object onto which to store the result.
* @returns {Matrix3} The modified result parameter or a new Matrix3 instance if one was not provided.
*
* @exception {DeveloperError} right is required.
*/
Matrix3.prototype.multiply = function(right, result) {
return Matrix3.multiply(this, right, result);
};
/**
* Computes the product of this matrix and a column vector.
* @memberof Matrix3
*
* @param {Cartesian3} cartesian The column.
* @param {Cartesian3} [result] The object onto which to store the result.
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided.
*
* @exception {DeveloperError} cartesian is required.
*/
Matrix3.prototype.multiplyByVector = function(cartesian, result) {
return Matrix3.multiplyByVector(this, cartesian, result);
};
/**
* Computes the product of this matrix and a scalar.
* @memberof Matrix3
*
* @param {Number} scalar The number to multiply by.
* @param {Matrix3} [result] The object onto which to store the result.
* @returns {Matrix3} The modified result parameter or a new Cartesian3 instance if one was not provided.
*
* @exception {DeveloperError} scalar is required and must be a number.
*/
Matrix3.prototype.multiplyByScalar = function(scalar, result) {
return Matrix3.multiplyByScalar(this, scalar, result);
};
/**
* Creates a negated copy of this matrix.
* @memberof Matrix3
*
* @param {Matrix3} matrix The matrix to negate.
* @param {Matrix3} [result] The object onto which to store the result.
* @returns {Matrix3} The modified result parameter or a new Matrix3 instance if one was not provided.
*
* @exception {DeveloperError} matrix is required.
*/
Matrix3.prototype.negate = function(result) {
return Matrix3.negate(this, result);
};
/**
* Computes the transpose of this matrix.
* @memberof Matrix3
*
* @param {Matrix3} [result] The object onto which to store the result.
* @returns {Matrix3} The modified result parameter or a new Matrix3 instance if one was not provided.
*/
Matrix3.prototype.transpose = function(result) {
return Matrix3.transpose(this, result);
};
/**
* Compares this matrix to the provided matrix componentwise and returns
* <code>true</code> if they are equal, <code>false</code> otherwise.
* @memberof Matrix3
*
* @param {Matrix3} [right] The right hand side matrix.
* @returns {Boolean} <code>true</code> if they are equal, <code>false</code> otherwise.
*/
Matrix3.prototype.equals = function(right) {
return Matrix3.equals(this, right);
};
/**
* Compares this matrix to the provided matrix componentwise and returns
* <code>true</code> if they are within the provided epsilon,
* <code>false</code> otherwise.
* @memberof Matrix3
*
* @param {Matrix3} [right] The right hand side matrix.
* @param {Number} epsilon The epsilon to use for equality testing.
* @returns {Boolean} <code>true</code> if they are within the provided epsilon, <code>false</code> otherwise.
*
* @exception {DeveloperError} epsilon is required and must be a number.
*/
Matrix3.prototype.equalsEpsilon = function(right, epsilon) {
return Matrix3.equalsEpsilon(this, right, epsilon);
};
/**
* Creates a string representing this Matrix with each row being
* on a separate line and in the format '(column0, column1, column2)'.
* @memberof Matrix3
*
* @returns {String} A string representing the provided Matrix with each row being on a separate line and in the format '(column0, column1, column2)'.
*/
Matrix3.prototype.toString = function() {
return '(' + this[0] + ', ' + this[3] + ', ' + this[6] + ')\n' +
'(' + this[1] + ', ' + this[4] + ', ' + this[7] + ')\n' +
'(' + this[2] + ', ' + this[5] + ', ' + this[8] + ')';
};
return Matrix3;
});
/*global define*/
define('Core/RuntimeError',['./defined'], function(defined) {
"use strict";
/**
* Constructs an exception object that is thrown due to an error that can occur at runtime, e.g.,
* out of memory, could not compile shader, etc. If a function may throw this
* exception, the calling code should be prepared to catch it.
* <br /><br />
* On the other hand, a {@link DeveloperError} indicates an exception due
* to a developer error, e.g., invalid argument, that usually indicates a bug in the
* calling code.
*
* @alias RuntimeError
*
* @param {String} [message=undefined] The error message for this exception.
*
* @see DeveloperError
* @constructor
*/
var RuntimeError = function(message) {
/**
* 'RuntimeError' indicating that this exception was thrown due to a runtime error.
* @type {String}
* @constant
* @default
*/
this.name = 'RuntimeError';
/**
* The explanation for why this exception was thrown.
* @type {String}
* @constant
*/
this.message = message;
var e = new Error();
/**
* The stack trace of this exception, if available.
* @type {String}
* @constant
*/
this.stack = e.stack;
};
RuntimeError.prototype.toString = function() {
var str = this.name + ': ' + this.message;
if (defined(this.stack)) {
str += '\n' + this.stack.toString();
}
return str;
};
return RuntimeError;
});
/*global define*/
define('Core/Matrix4',[
'./Cartesian3',
'./Cartesian4',
'./defaultValue',
'./defined',
'./DeveloperError',
'./freezeObject',
'./Math',
'./Matrix3',
'./RuntimeError'
], function(
Cartesian3,
Cartesian4,
defaultValue,
defined,
DeveloperError,
freezeObject,
CesiumMath,
Matrix3,
RuntimeError) {
"use strict";
/**
* A 4x4 matrix, indexable as a column-major order array.
* Constructor parameters are in row-major order for code readability.
* @alias Matrix4
* @constructor
*
* @param {Number} [column0Row0=0.0] The value for column 0, row 0.
* @param {Number} [column1Row0=0.0] The value for column 1, row 0.
* @param {Number} [column2Row0=0.0] The value for column 2, row 0.
* @param {Number} [column3Row0=0.0] The value for column 3, row 0.
* @param {Number} [column0Row1=0.0] The value for column 0, row 1.
* @param {Number} [column1Row1=0.0] The value for column 1, row 1.
* @param {Number} [column2Row1=0.0] The value for column 2, row 1.
* @param {Number} [column3Row1=0.0] The value for column 3, row 1.
* @param {Number} [column0Row2=0.0] The value for column 0, row 2.
* @param {Number} [column1Row2=0.0] The value for column 1, row 2.
* @param {Number} [column2Row2=0.0] The value for column 2, row 2.
* @param {Number} [column3Row2=0.0] The value for column 3, row 2.
* @param {Number} [column0Row3=0.0] The value for column 0, row 3.
* @param {Number} [column1Row3=0.0] The value for column 1, row 3.
* @param {Number} [column2Row3=0.0] The value for column 2, row 3.
* @param {Number} [column3Row3=0.0] The value for column 3, row 3.
*
* @see Matrix4.fromColumnMajorArray
* @see Matrix4.fromRowMajorArray
* @see Matrix4.fromRotationTranslation
* @see Matrix4.fromTranslation
* @see Matrix4.fromScale
* @see Matrix4.fromUniformScale
* @see Matrix4.fromCamera
* @see Matrix4.computePerspectiveFieldOfView
* @see Matrix4.computeOrthographicOffCenter
* @see Matrix4.computePerspectiveOffCenter
* @see Matrix4.computeInfinitePerspectiveOffCenter
* @see Matrix4.computeViewportTransformation
* @see Matrix2
* @see Matrix3
*/
var Matrix4 = function(column0Row0, column1Row0, column2Row0, column3Row0,
column0Row1, column1Row1, column2Row1, column3Row1,
column0Row2, column1Row2, column2Row2, column3Row2,
column0Row3, column1Row3, column2Row3, column3Row3) {
this[0] = defaultValue(column0Row0, 0.0);
this[1] = defaultValue(column0Row1, 0.0);
this[2] = defaultValue(column0Row2, 0.0);
this[3] = defaultValue(column0Row3, 0.0);
this[4] = defaultValue(column1Row0, 0.0);
this[5] = defaultValue(column1Row1, 0.0);
this[6] = defaultValue(column1Row2, 0.0);
this[7] = defaultValue(column1Row3, 0.0);
this[8] = defaultValue(column2Row0, 0.0);
this[9] = defaultValue(column2Row1, 0.0);
this[10] = defaultValue(column2Row2, 0.0);
this[11] = defaultValue(column2Row3, 0.0);
this[12] = defaultValue(column3Row0, 0.0);
this[13] = defaultValue(column3Row1, 0.0);
this[14] = defaultValue(column3Row2, 0.0);
this[15] = defaultValue(column3Row3, 0.0);
};
/**
* Duplicates a Matrix4 instance.
* @memberof Matrix4
*
* @param {Matrix4} matrix The matrix to duplicate.
* @param {Matrix4} [result] The object onto which to store the result.
* @returns {Matrix4} The modified result parameter or a new Matrix4 instance if one was not provided. (Returns undefined if matrix is undefined)
*/
Matrix4.clone = function(matrix, result) {
if (!defined(matrix)) {
return undefined;
}
if (!defined(result)) {
return new Matrix4(matrix[0], matrix[4], matrix[8], matrix[12],
matrix[1], matrix[5], matrix[9], matrix[13],
matrix[2], matrix[6], matrix[10], matrix[14],
matrix[3], matrix[7], matrix[11], matrix[15]);
}
result[0] = matrix[0];
result[1] = matrix[1];
result[2] = matrix[2];
result[3] = matrix[3];
result[4] = matrix[4];
result[5] = matrix[5];
result[6] = matrix[6];
result[7] = matrix[7];
result[8] = matrix[8];
result[9] = matrix[9];
result[10] = matrix[10];
result[11] = matrix[11];
result[12] = matrix[12];
result[13] = matrix[13];
result[14] = matrix[14];
result[15] = matrix[15];
return result;
};
/**
* Computes a Matrix4 instance from a column-major order array.
* @memberof Matrix4
* @function
*
* @param {Array} values The column-major order array.
* @param {Matrix4} [result] The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix4 instance if one was not provided.
*
* @exception {DeveloperError} values is required.
*/
Matrix4.fromColumnMajorArray = function(values, result) {
if (!defined(values)) {
throw new DeveloperError('values parameter is required');
}
return Matrix4.clone(values, result);
};
/**
* Computes a Matrix4 instance from a row-major order array.
* The resulting matrix will be in column-major order.
* @memberof Matrix4
*
* @param {Array} values The row-major order array.
* @param {Matrix4} [result] The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix4 instance if one was not provided.
*
* @exception {DeveloperError} values is required.
*/
Matrix4.fromRowMajorArray = function(values, result) {
if (!defined(values)) {
throw new DeveloperError('values is required.');
}
if (!defined(result)) {
return new Matrix4(values[0], values[1], values[2], values[3],
values[4], values[5], values[6], values[7],
values[8], values[9], values[10], values[11],
values[12], values[13], values[14], values[15]);
}
result[0] = values[0];
result[1] = values[4];
result[2] = values[8];
result[3] = values[12];
result[4] = values[1];
result[5] = values[5];
result[6] = values[9];
result[7] = values[13];
result[8] = values[2];
result[9] = values[6];
result[10] = values[10];
result[11] = values[14];
result[12] = values[3];
result[13] = values[7];
result[14] = values[11];
result[15] = values[15];
return result;
};
/**
* Computes a Matrix4 instance from a Matrix3 representing the rotation
* and a Cartesian3 representing the translation.
* @memberof Matrix4
*
* @param {Matrix3} rotation The upper left portion of the matrix representing the rotation.
* @param {Cartesian3} translation The upper right portion of the matrix representing the translation.
* @param {Matrix4} [result] The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix4 instance if one was not provided.
*
* @exception {DeveloperError} rotation is required.
* @exception {DeveloperError} translation is required.
*/
Matrix4.fromRotationTranslation = function(rotation, translation, result) {
if (!defined(rotation)) {
throw new DeveloperError('rotation is required.');
}
if (!defined(translation)) {
throw new DeveloperError('translation is required.');
}
if (!defined(result)) {
return new Matrix4(rotation[0], rotation[3], rotation[6], translation.x,
rotation[1], rotation[4], rotation[7], translation.y,
rotation[2], rotation[5], rotation[8], translation.z,
0.0, 0.0, 0.0, 1.0);
}
result[0] = rotation[0];
result[1] = rotation[1];
result[2] = rotation[2];
result[3] = 0.0;
result[4] = rotation[3];
result[5] = rotation[4];
result[6] = rotation[5];
result[7] = 0.0;
result[8] = rotation[6];
result[9] = rotation[7];
result[10] = rotation[8];
result[11] = 0.0;
result[12] = translation.x;
result[13] = translation.y;
result[14] = translation.z;
result[15] = 1.0;
return result;
};
/**
* Creates a Matrix4 instance from a Cartesian3 representing the translation.
* @memberof Matrix4
*
* @param {Cartesian3} translation The upper right portion of the matrix representing the translation.
* @param {Matrix4} [result] The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix4 instance if one was not provided.
*
* @see Matrix4.multiplyByTranslation
*
* @exception {DeveloperError} translation is required.
*/
Matrix4.fromTranslation = function(translation, result) {
return Matrix4.fromRotationTranslation(Matrix3.IDENTITY, translation, result);
};
/**
* Computes a Matrix4 instance representing a non-uniform scale.
* @memberof Matrix4
*
* @param {Cartesian3} scale The x, y, and z scale factors.
* @param {Matrix4} [result] The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix4 instance if one was not provided.
*
* @exception {DeveloperError} scale is required.
*
* @example
* // Creates
* // [7.0, 0.0, 0.0, 0.0]
* // [0.0, 8.0, 0.0, 0.0]
* // [0.0, 0.0, 9.0, 0.0]
* // [0.0, 0.0, 0.0, 1.0]
* var m = Matrix4.fromScale(new Cartesian3(7.0, 8.0, 9.0));
*/
Matrix4.fromScale = function(scale, result) {
if (!defined(scale)) {
throw new DeveloperError('scale is required.');
}
if (!defined(result)) {
return new Matrix4(
scale.x, 0.0, 0.0, 0.0,
0.0, scale.y, 0.0, 0.0,
0.0, 0.0, scale.z, 0.0,
0.0, 0.0, 0.0, 1.0);
}
result[0] = scale.x;
result[1] = 0.0;
result[2] = 0.0;
result[3] = 0.0;
result[4] = 0.0;
result[5] = scale.y;
result[6] = 0.0;
result[7] = 0.0;
result[8] = 0.0;
result[9] = 0.0;
result[10] = scale.z;
result[11] = 0.0;
result[12] = 0.0;
result[13] = 0.0;
result[14] = 0.0;
result[15] = 1.0;
return result;
};
/**
* Computes a Matrix4 instance representing a uniform scale.
* @memberof Matrix4
*
* @param {Number} scale The uniform scale factor.
* @param {Matrix4} [result] The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix4 instance if one was not provided.
*
* @exception {DeveloperError} scale is required.
*
* @example
* // Creates
* // [2.0, 0.0, 0.0, 0.0]
* // [0.0, 2.0, 0.0, 0.0]
* // [0.0, 0.0, 2.0, 0.0]
* // [0.0, 0.0, 0.0, 1.0]
* var m = Matrix4.fromScale(2.0);
*/
Matrix4.fromUniformScale = function(scale, result) {
if (typeof scale !== 'number') {
throw new DeveloperError('scale is required.');
}
if (!defined(result)) {
return new Matrix4(scale, 0.0, 0.0, 0.0,
0.0, scale, 0.0, 0.0,
0.0, 0.0, scale, 0.0,
0.0, 0.0, 0.0, 1.0);
}
result[0] = scale;
result[1] = 0.0;
result[2] = 0.0;
result[3] = 0.0;
result[4] = 0.0;
result[5] = scale;
result[6] = 0.0;
result[7] = 0.0;
result[8] = 0.0;
result[9] = 0.0;
result[10] = scale;
result[11] = 0.0;
result[12] = 0.0;
result[13] = 0.0;
result[14] = 0.0;
result[15] = 1.0;
return result;
};
var fromCameraF = new Cartesian3();
var fromCameraS = new Cartesian3();
var fromCameraU = new Cartesian3();
/**
* Computes a Matrix4 instance from a Camera.
* @memberof Matrix4
*
* @param {Camera} camera The camera to use.
* @param {Matrix4} [result] The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix4 instance if one was not provided.
*
* @exception {DeveloperError} camera is required.
* @exception {DeveloperError} camera.eye is required.
* @exception {DeveloperError} camera.target is required.
* @exception {DeveloperError} camera.up is required.
*/
Matrix4.fromCamera = function(camera, result) {
if (!defined(camera)) {
throw new DeveloperError('camera is required.');
}
var eye = camera.eye;
var target = camera.target;
var up = camera.up;
if (!defined(eye)) {
throw new DeveloperError('camera.eye is required.');
}
if (!defined(target)) {
throw new DeveloperError('camera.target is required.');
}
if (!defined(up)) {
throw new DeveloperError('camera.up is required.');
}
Cartesian3.normalize(Cartesian3.subtract(target, eye, fromCameraF), fromCameraF);
Cartesian3.normalize(Cartesian3.cross(fromCameraF, up, fromCameraS), fromCameraS);
Cartesian3.normalize(Cartesian3.cross(fromCameraS, fromCameraF, fromCameraU), fromCameraU);
var sX = fromCameraS.x;
var sY = fromCameraS.y;
var sZ = fromCameraS.z;
var fX = fromCameraF.x;
var fY = fromCameraF.y;
var fZ = fromCameraF.z;
var uX = fromCameraU.x;
var uY = fromCameraU.y;
var uZ = fromCameraU.z;
var eyeX = eye.x;
var eyeY = eye.y;
var eyeZ = eye.z;
var t0 = sX * -eyeX + sY * -eyeY+ sZ * -eyeZ;
var t1 = uX * -eyeX + uY * -eyeY+ uZ * -eyeZ;
var t2 = fX * eyeX + fY * eyeY + fZ * eyeZ;
//The code below this comment is an optimized
//version of the commented lines.
//Rather that create two matrices and then multiply,
//we just bake in the multiplcation as part of creation.
//var rotation = new Matrix4(
// sX, sY, sZ, 0.0,
// uX, uY, uZ, 0.0,
// -fX, -fY, -fZ, 0.0,
// 0.0, 0.0, 0.0, 1.0);
//var translation = new Matrix4(
// 1.0, 0.0, 0.0, -eye.x,
// 0.0, 1.0, 0.0, -eye.y,
// 0.0, 0.0, 1.0, -eye.z,
// 0.0, 0.0, 0.0, 1.0);
//return rotation.multiply(translation);
if (!defined(result)) {
return new Matrix4(
sX, sY, sZ, t0,
uX, uY, uZ, t1,
-fX, -fY, -fZ, t2,
0.0, 0.0, 0.0, 1.0);
}
result[0] = sX;
result[1] = uX;
result[2] = -fX;
result[3] = 0.0;
result[4] = sY;
result[5] = uY;
result[6] = -fY;
result[7] = 0.0;
result[8] = sZ;
result[9] = uZ;
result[10] = -fZ;
result[11] = 0.0;
result[12] = t0;
result[13] = t1;
result[14] = t2;
result[15] = 1.0;
return result;
};
/**
* Computes a Matrix4 instance representing a perspective transformation matrix.
* @memberof Matrix4
*
* @param {Number} fovY The field of view along the Y axis in radians.
* @param {Number} aspectRatio The aspect ratio.
* @param {Number} near The distance to the near plane in meters.
* @param {Number} far The distance to the far plane in meters.
* @param {Matrix4} [result] The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix4 instance if one was not provided.
*
* @exception {DeveloperError} fovY must be in [0, PI).
* @exception {DeveloperError} aspectRatio must be greater than zero.
* @exception {DeveloperError} near must be greater than zero.
* @exception {DeveloperError} far must be greater than zero.
*/
Matrix4.computePerspectiveFieldOfView = function(fovY, aspectRatio, near, far, result) {
if (fovY <= 0.0 || fovY > Math.PI) {
throw new DeveloperError('fovY must be in [0, PI).');
}
if (aspectRatio <= 0.0) {
throw new DeveloperError('aspectRatio must be greater than zero.');
}
if (near <= 0.0) {
throw new DeveloperError('near must be greater than zero.');
}
if (far <= 0.0) {
throw new DeveloperError('far must be greater than zero.');
}
var bottom = Math.tan(fovY * 0.5);
var column1Row1 = 1.0 / bottom;
var column0Row0 = column1Row1 / aspectRatio;
var column2Row2 = (far + near) / (near - far);
var column3Row2 = (2.0 * far * near) / (near - far);
if (!defined(result)) {
return new Matrix4(column0Row0, 0.0, 0.0, 0.0,
0.0, column1Row1, 0.0, 0.0,
0.0, 0.0, column2Row2, column3Row2,
0.0, 0.0, -1.0, 0.0);
}
result[0] = column0Row0;
result[1] = 0.0;
result[2] = 0.0;
result[3] = 0.0;
result[4] = 0.0;
result[5] = column1Row1;
result[6] = 0.0;
result[7] = 0.0;
result[8] = 0.0;
result[9] = 0.0;
result[10] = column2Row2;
result[11] = -1.0;
result[12] = 0.0;
result[13] = 0.0;
result[14] = column3Row2;
result[15] = 0.0;
return result;
};
/**
* Computes a Matrix4 instance representing an orthographic transformation matrix.
* @memberof Matrix4
*
* @param {Number} left The number of meters to the left of the camera that will be in view.
* @param {Number} right The number of meters to the right of the camera that will be in view.
* @param {Number} bottom The number of meters below of the camera that will be in view.
* @param {Number} top The number of meters above of the camera that will be in view.
* @param {Number} near The distance to the near plane in meters.
* @param {Number} far The distance to the far plane in meters.
* @param {Matrix4} [result] The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix4 instance if one was not provided.
*
* @exception {DeveloperError} left is required.
* @exception {DeveloperError} right is required.
* @exception {DeveloperError} bottom is required.
* @exception {DeveloperError} top is required.
* @exception {DeveloperError} near is required.
* @exception {DeveloperError} far is required.
*/
Matrix4.computeOrthographicOffCenter = function(left, right, bottom, top, near, far, result) {
if (!defined(left)) {
throw new DeveloperError('left is required.');
}
if (!defined(right)) {
throw new DeveloperError('right is required.');
}
if (!defined(bottom)) {
throw new DeveloperError('bottom is required.');
}
if (!defined(top)) {
throw new DeveloperError('top is required.');
}
if (!defined(near)) {
throw new DeveloperError('near is required.');
}
if (!defined(far)) {
throw new DeveloperError('far is required.');
}
var a = 1.0 / (right - left);
var b = 1.0 / (top - bottom);
var c = 1.0 / (far - near);
var tx = -(right + left) * a;
var ty = -(top + bottom) * b;
var tz = -(far + near) * c;
a *= 2.0;
b *= 2.0;
c *= -2.0;
if (!defined(result)) {
return new Matrix4( a, 0.0, 0.0, tx,
0.0, b, 0.0, ty,
0.0, 0.0, c, tz,
0.0, 0.0, 0.0, 1.0);
}
result[0] = a;
result[1] = 0.0;
result[2] = 0.0;
result[3] = 0.0;
result[4] = 0.0;
result[5] = b;
result[6] = 0.0;
result[7] = 0.0;
result[8] = 0.0;
result[9] = 0.0;
result[10] = c;
result[11] = 0.0;
result[12] = tx;
result[13] = ty;
result[14] = tz;
result[15] = 1.0;
return result;
};
/**
* Computes a Matrix4 instance representing an off center perspective transformation.
* @memberof Matrix4
*
* @param {Number} left The number of meters to the left of the camera that will be in view.
* @param {Number} right The number of meters to the right of the camera that will be in view.
* @param {Number} bottom The number of meters below of the camera that will be in view.
* @param {Number} top The number of meters above of the camera that will be in view.
* @param {Number} near The distance to the near plane in meters.
* @param {Number} far The distance to the far plane in meters.
* @param {Matrix4} [result] The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix4 instance if one was not provided.
*
* @exception {DeveloperError} left is required.
* @exception {DeveloperError} right is required.
* @exception {DeveloperError} bottom is required.
* @exception {DeveloperError} top is required.
* @exception {DeveloperError} near is required.
* @exception {DeveloperError} far is required.
*/
Matrix4.computePerspectiveOffCenter = function(left, right, bottom, top, near, far, result) {
if (!defined(left)) {
throw new DeveloperError('left is required.');
}
if (!defined(right)) {
throw new DeveloperError('right is required.');
}
if (!defined(bottom)) {
throw new DeveloperError('bottom is required.');
}
if (!defined(top)) {
throw new DeveloperError('top is required.');
}
if (!defined(near)) {
throw new DeveloperError('near is required.');
}
if (!defined(far)) {
throw new DeveloperError('far is required.');
}
var column0Row0 = 2.0 * near / (right - left);
var column1Row1 = 2.0 * near / (top - bottom);
var column2Row0 = (right + left) / (right - left);
var column2Row1 = (top + bottom) / (top - bottom);
var column2Row2 = -(far + near) / (far - near);
var column2Row3 = -1.0;
var column3Row2 = -2.0 * far * near / (far - near);
if (!defined(result)) {
return new Matrix4(column0Row0, 0.0, column2Row0, 0.0,
0.0, column1Row1, column2Row1, 0.0,
0.0, 0.0, column2Row2, column3Row2,
0.0, 0.0, column2Row3, 0.0);
}
result[0] = column0Row0;
result[1] = 0.0;
result[2] = 0.0;
result[3] = 0.0;
result[4] = 0.0;
result[5] = column1Row1;
result[6] = 0.0;
result[7] = 0.0;
result[8] = column2Row0;
result[9] = column2Row1;
result[10] = column2Row2;
result[11] = column2Row3;
result[12] = 0.0;
result[13] = 0.0;
result[14] = column3Row2;
result[15] = 0.0;
return result;
};
/**
* Computes a Matrix4 instance representing an infinite off center perspective transformation.
* @memberof Matrix4
*
* @param {Number} left The number of meters to the left of the camera that will be in view.
* @param {Number} right The number of meters to the right of the camera that will be in view.
* @param {Number} bottom The number of meters below of the camera that will be in view.
* @param {Number} top The number of meters above of the camera that will be in view.
* @param {Number} near The distance to the near plane in meters.
* @param {Number} far The distance to the far plane in meters.
* @param {Matrix4} [result] The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix4 instance if one was not provided.
*
* @exception {DeveloperError} left is required.
* @exception {DeveloperError} right is required.
* @exception {DeveloperError} bottom is required.
* @exception {DeveloperError} top is required.
* @exception {DeveloperError} near is required.
*/
Matrix4.computeInfinitePerspectiveOffCenter = function(left, right, bottom, top, near, result) {
if (!defined(left)) {
throw new DeveloperError('left is required.');
}
if (!defined(right)) {
throw new DeveloperError('right is required.');
}
if (!defined(bottom)) {
throw new DeveloperError('bottom is required.');
}
if (!defined(top)) {
throw new DeveloperError('top is required.');
}
if (!defined(near)) {
throw new DeveloperError('near is required.');
}
var column0Row0 = 2.0 * near / (right - left);
var column1Row1 = 2.0 * near / (top - bottom);
var column2Row0 = (right + left) / (right - left);
var column2Row1 = (top + bottom) / (top - bottom);
var column2Row2 = -1.0;
var column2Row3 = -1.0;
var column3Row2 = -2.0 * near;
if (!defined(result)) {
return new Matrix4(column0Row0, 0.0, column2Row0, 0.0,
0.0, column1Row1, column2Row1, 0.0,
0.0, 0.0, column2Row2, column3Row2,
0.0, 0.0, column2Row3, 0.0);
}
result[0] = column0Row0;
result[1] = 0.0;
result[2] = 0.0;
result[3] = 0.0;
result[4] = 0.0;
result[5] = column1Row1;
result[6] = 0.0;
result[7] = 0.0;
result[8] = column2Row0;
result[9] = column2Row1;
result[10] = column2Row2;
result[11] = column2Row3;
result[12] = 0.0;
result[13] = 0.0;
result[14] = column3Row2;
result[15] = 0.0;
return result;
};
/**
* Computes a Matrix4 instance that transforms from normalized device coordinates to window coordinates.
* @memberof Matrix4
*
* @param {Object}[viewport = { x : 0.0, y : 0.0, width : 0.0, height : 0.0 }] The viewport's corners as shown in Example 1.
* @param {Number}[nearDepthRange = 0.0] The near plane distance in window coordinates.
* @param {Number}[farDepthRange = 1.0] The far plane distance in window coordinates.
* @param {Matrix4} [result] The object in which the result will be stored, if undefined a new instance will be created.
* @returns The modified result parameter, or a new Matrix4 instance if one was not provided.
*
* @see czm_viewportTransformation
* @see Context#getViewport
*
* @example
* // Example 1. Create viewport transformation using an explicit viewport and depth range.
* var m = Matrix4.computeViewportTransformation({
* x : 0.0,
* y : 0.0,
* width : 1024.0,
* height : 768.0
* }, 0.0, 1.0);
*
* // Example 2. Create viewport transformation using the context's viewport.
* var m = Matrix4.computeViewportTransformation(context.getViewport());
*/
Matrix4.computeViewportTransformation = function(viewport, nearDepthRange, farDepthRange, result) {
viewport = defaultValue(viewport, defaultValue.EMPTY_OBJECT);
var x = defaultValue(viewport.x, 0.0);
var y = defaultValue(viewport.y, 0.0);
var width = defaultValue(viewport.width, 0.0);
var height = defaultValue(viewport.height, 0.0);
nearDepthRange = defaultValue(nearDepthRange, 0.0);
farDepthRange = defaultValue(farDepthRange, 1.0);
var halfWidth = width * 0.5;
var halfHeight = height * 0.5;
var halfDepth = (farDepthRange - nearDepthRange) * 0.5;
var column0Row0 = halfWidth;
var column1Row1 = halfHeight;
var column2Row2 = halfDepth;
var column3Row0 = x + halfWidth;
var column3Row1 = y + halfHeight;
var column3Row2 = nearDepthRange + halfDepth;
var column3Row3 = 1.0;
if (!defined(result)) {
return new Matrix4(column0Row0, 0.0, 0.0, column3Row0,
0.0, column1Row1, 0.0, column3Row1,
0.0, 0.0, column2Row2, column3Row2,
0.0, 0.0, 0.0, column3Row3);
}
result[0] = column0Row0;
result[1] = 0.0;
result[2] = 0.0;
result[3] = 0.0;
result[4] = 0.0;
result[5] = column1Row1;
result[6] = 0.0;
result[7] = 0.0;
result[8] = 0.0;
result[9] = 0.0;
result[10] = column2Row2;
result[11] = 0.0;
result[12] = column3Row0;
result[13] = column3Row1;
result[14] = column3Row2;
result[15] = column3Row3;
return result;
};
/**
* Computes an Array from the provided Matrix4 instance.
* The array will be in column-major order.
* @memberof Matrix4
*
* @param {Matrix4} matrix The matrix to use..
* @param {Array} [result] The Array onto which to store the result.
* @returns {Array} The modified Array parameter or a new Array instance if one was not provided.
*
* @exception {DeveloperError} matrix is required.
*
* @example
* //create an array from an instance of Matrix4
* // m = [10.0, 14.0, 18.0, 22.0]
* // [11.0, 15.0, 19.0, 23.0]
* // [12.0, 16.0, 20.0, 24.0]
* // [13.0, 17.0, 21.0, 25.0]
* var a = Matrix4.toArray(m);
*
* // m remains the same
* //creates a = [10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0, 25.0]
*
*/
Matrix4.toArray = function(matrix, result) {
if (!defined(matrix)) {
throw new DeveloperError('matrix is required');
}
if (!defined(result)) {
return [matrix[0], matrix[1], matrix[2], matrix[3],
matrix[4], matrix[5], matrix[6], matrix[7],
matrix[8], matrix[9], matrix[10], matrix[11],
matrix[12], matrix[13], matrix[14], matrix[15]];
}
result[0] = matrix[0];
result[1] = matrix[1];
result[2] = matrix[2];
result[3] = matrix[3];
result[4] = matrix[4];
result[5] = matrix[5];
result[6] = matrix[6];
result[7] = matrix[7];
result[8] = matrix[8];
result[9] = matrix[9];
result[10] = matrix[10];
result[11] = matrix[11];
result[12] = matrix[12];
result[13] = matrix[13];
result[14] = matrix[14];
result[15] = matrix[15];
return result;
};
/**
* Computes the array index of the element at the provided row and column.
* @memberof Matrix4
*
* @param {Number} row The zero-based index of the row.
* @param {Number} column The zero-based index of the column.
* @returns {Number} The index of the element at the provided row and column.
*
* @exception {DeveloperError} row is required and must be 0, 1, 2, or 3.
* @exception {DeveloperError} column is required and must be 0, 1, 2, or 3.
*
* @example
* var myMatrix = new Matrix4();
* var column1Row0Index = Matrix4.getElementIndex(1, 0);
* var column1Row0 = myMatrix[column1Row0Index]
* myMatrix[column1Row0Index] = 10.0;
*/
Matrix4.getElementIndex = function(column, row) {
if (typeof row !== 'number' || row < 0 || row > 3) {
throw new DeveloperError('row is required and must be 0, 1, 2, or 3.');
}
if (typeof column !== 'number' || column < 0 || column > 3) {
throw new DeveloperError('column is required and must be 0, 1, 2, or 3.');
}
return column * 4 + row;
};
/**
* Retrieves a copy of the matrix column at the provided index as a Cartesian4 instance.
* @memberof Matrix4
*
* @param {Matrix4} matrix The matrix to use.
* @param {Number} index The zero-based index of the column to retrieve.
* @param {Cartesian4} [result] The object onto which to store the result.
* @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided.
*
* @exception {DeveloperError} matrix is required.
* @exception {DeveloperError} index is required and must be 0, 1, 2, or 3.
*
* @see Cartesian4
*
* @example
* //returns a Cartesian4 instance with values from the specified column
* // m = [10.0, 11.0, 12.0, 13.0]
* // [14.0, 15.0, 16.0, 17.0]
* // [18.0, 19.0, 20.0, 21.0]
* // [22.0, 23.0, 24.0, 25.0]
*
* //Example 1: Creates an instance of Cartesian
* var a = Matrix4.getColumn(m, 2);
*
* //Example 2: Sets values for Cartesian instance
* var a = new Cartesian4();
* Matrix4.getColumn(m, 2, a);
*
* // a.x = 12.0; a.y = 16.0; a.z = 20.0; a.w = 24.0;
*
*/
Matrix4.getColumn = function(matrix, index, result) {
if (!defined(matrix)) {
throw new DeveloperError('matrix is required.');
}
if (typeof index !== 'number' || index < 0 || index > 3) {
throw new DeveloperError('index is required and must be 0, 1, 2, or 3.');
}
var startIndex = index * 4;
var x = matrix[startIndex];
var y = matrix[startIndex + 1];
var z = matrix[startIndex + 2];
var w = matrix[startIndex + 3];
if (!defined(result)) {
return new Cartesian4(x, y, z, w);
}
result.x = x;
result.y = y;
result.z = z;
result.w = w;
return result;
};
/**
* Computes a new matrix that replaces the specified column in the provided matrix with the provided Cartesian4 instance.
* @memberof Matrix4
*
* @param {Matrix4} matrix The matrix to use.
* @param {Number} index The zero-based index of the column to set.
* @param {Cartesian4} cartesian The Cartesian whose values will be assigned to the specified column.
* @param {Cartesian4} [result] The object onto which to store the result.
* @returns {Matrix4} The modified result parameter or a new Matrix4 instance if one was not provided.
*
* @exception {DeveloperError} matrix is required.
* @exception {DeveloperError} cartesian is required.
* @exception {DeveloperError} index is required and must be 0, 1, 2, or 3.
*
* @see Cartesian4
*
* @example
* //creates a new Matrix4 instance with new column values from the Cartesian4 instance
* // m = [10.0, 11.0, 12.0, 13.0]
* // [14.0, 15.0, 16.0, 17.0]
* // [18.0, 19.0, 20.0, 21.0]
* // [22.0, 23.0, 24.0, 25.0]
*
* var a = Matrix4.setColumn(m, 2, new Cartesian4(99.0, 98.0, 97.0, 96.0));
*
* // m remains the same
* // a = [10.0, 11.0, 99.0, 13.0]
* // [14.0, 15.0, 98.0, 17.0]
* // [18.0, 19.0, 97.0, 21.0]
* // [22.0, 23.0, 96.0, 25.0]
*
*/
Matrix4.setColumn = function(matrix, index, cartesian, result) {
if (!defined(matrix)) {
throw new DeveloperError('matrix is required');
}
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required');
}
if (typeof index !== 'number' || index < 0 || index > 3) {
throw new DeveloperError('index is required and must be 0, 1, 2, or 3.');
}
result = Matrix4.clone(matrix, result);
var startIndex = index * 4;
result[startIndex] = cartesian.x;
result[startIndex + 1] = cartesian.y;
result[startIndex + 2] = cartesian.z;
result[startIndex + 3] = cartesian.w;
return result;
};
/**
* Retrieves a copy of the matrix row at the provided index as a Cartesian4 instance.
* @memberof Matrix4
*
* @param {Matrix4} matrix The matrix to use.
* @param {Number} index The zero-based index of the row to retrieve.
* @param {Cartesian4} [result] The object onto which to store the result.
* @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided.
*
* @exception {DeveloperError} matrix is required.
* @exception {DeveloperError} index is required and must be 0, 1, 2, or 3.
*
* @see Cartesian4
*
* @example
* //returns a Cartesian4 instance with values from the specified column
* // m = [10.0, 11.0, 12.0, 13.0]
* // [14.0, 15.0, 16.0, 17.0]
* // [18.0, 19.0, 20.0, 21.0]
* // [22.0, 23.0, 24.0, 25.0]
*
* //Example 1: Returns an instance of Cartesian
* var a = Matrix4.getRow(m, 2);
*
* //Example 1: Sets values for a Cartesian instance
* var a = new Cartesian4();
* Matrix4.getRow(m, 2, a);
*
* // a.x = 18.0; a.y = 19.0; a.z = 20.0; a.w = 21.0;
*/
Matrix4.getRow = function(matrix, index, result) {
if (!defined(matrix)) {
throw new DeveloperError('matrix is required.');
}
if (typeof index !== 'number' || index < 0 || index > 3) {
throw new DeveloperError('index is required and must be 0, 1, 2, or 3.');
}
var x = matrix[index];
var y = matrix[index + 4];
var z = matrix[index + 8];
var w = matrix[index + 12];
if (!defined(result)) {
return new Cartesian4(x, y, z, w);
}
result.x = x;
result.y = y;
result.z = z;
result.w = w;
return result;
};
/**
* Computes a new matrix that replaces the specified row in the provided matrix with the provided Cartesian4 instance.
* @memberof Matrix4
*
* @param {Matrix4} matrix The matrix to use.
* @param {Number} index The zero-based index of the row to set.
* @param {Cartesian4} cartesian The Cartesian whose values will be assigned to the specified row.
* @param {Cartesian4} [result] The object onto which to store the result.
* @returns {Matrix4} The modified result parameter or a new Matrix4 instance if one was not provided.
*
* @exception {DeveloperError} matrix is required.
* @exception {DeveloperError} cartesian is required.
* @exception {DeveloperError} index is required and must be 0, 1, 2, or 3.
*
* @see Cartesian4
*
* @example
* //create a new Matrix4 instance with new row values from the Cartesian4 instance
* // m = [10.0, 11.0, 12.0, 13.0]
* // [14.0, 15.0, 16.0, 17.0]
* // [18.0, 19.0, 20.0, 21.0]
* // [22.0, 23.0, 24.0, 25.0]
*
* var a = Matrix4.setRow(m, 2, new Cartesian4(99.0, 98.0, 97.0, 96.0));
*
* // m remains the same
* // a = [10.0, 11.0, 12.0, 13.0]
* // [14.0, 15.0, 16.0, 17.0]
* // [99.0, 98.0, 97.0, 96.0]
* // [22.0, 23.0, 24.0, 25.0]
*
*/
Matrix4.setRow = function(matrix, index, cartesian, result) {
if (!defined(matrix)) {
throw new DeveloperError('matrix is required');
}
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required');
}
if (typeof index !== 'number' || index < 0 || index > 3) {
throw new DeveloperError('index is required and must be 0, 1, 2, or 3.');
}
result = Matrix4.clone(matrix, result);
result[index] = cartesian.x;
result[index + 4] = cartesian.y;
result[index + 8] = cartesian.z;
result[index + 12] = cartesian.w;
return result;
};
/**
* Computes the product of two matrices.
* @memberof Matrix4
*
* @param {Matrix4} left The first matrix.
* @param {Matrix4} right The second matrix.
* @param {Matrix4} [result] The object onto which to store the result.
* @returns {Matrix4} The modified result parameter or a new Matrix4 instance if one was not provided.
*
* @exception {DeveloperError} left is required.
* @exception {DeveloperError} right is required.
*/
Matrix4.multiply = function(left, right, result) {
if (!defined(left)) {
throw new DeveloperError('left is required');
}
if (!defined(right)) {
throw new DeveloperError('right is required');
}
var left0 = left[0];
var left1 = left[1];
var left2 = left[2];
var left3 = left[3];
var left4 = left[4];
var left5 = left[5];
var left6 = left[6];
var left7 = left[7];
var left8 = left[8];
var left9 = left[9];
var left10 = left[10];
var left11 = left[11];
var left12 = left[12];
var left13 = left[13];
var left14 = left[14];
var left15 = left[15];
var right0 = right[0];
var right1 = right[1];
var right2 = right[2];
var right3 = right[3];
var right4 = right[4];
var right5 = right[5];
var right6 = right[6];
var right7 = right[7];
var right8 = right[8];
var right9 = right[9];
var right10 = right[10];
var right11 = right[11];
var right12 = right[12];
var right13 = right[13];
var right14 = right[14];
var right15 = right[15];
var column0Row0 = left0 * right0 + left4 * right1 + left8 * right2 + left12 * right3;
var column0Row1 = left1 * right0 + left5 * right1 + left9 * right2 + left13 * right3;
var column0Row2 = left2 * right0 + left6 * right1 + left10 * right2 + left14 * right3;
var column0Row3 = left3 * right0 + left7 * right1 + left11 * right2 + left15 * right3;
var column1Row0 = left0 * right4 + left4 * right5 + left8 * right6 + left12 * right7;
var column1Row1 = left1 * right4 + left5 * right5 + left9 * right6 + left13 * right7;
var column1Row2 = left2 * right4 + left6 * right5 + left10 * right6 + left14 * right7;
var column1Row3 = left3 * right4 + left7 * right5 + left11 * right6 + left15 * right7;
var column2Row0 = left0 * right8 + left4 * right9 + left8 * right10 + left12 * right11;
var column2Row1 = left1 * right8 + left5 * right9 + left9 * right10 + left13 * right11;
var column2Row2 = left2 * right8 + left6 * right9 + left10 * right10 + left14 * right11;
var column2Row3 = left3 * right8 + left7 * right9 + left11 * right10 + left15 * right11;
var column3Row0 = left0 * right12 + left4 * right13 + left8 * right14 + left12 * right15;
var column3Row1 = left1 * right12 + left5 * right13 + left9 * right14 + left13 * right15;
var column3Row2 = left2 * right12 + left6 * right13 + left10 * right14 + left14 * right15;
var column3Row3 = left3 * right12 + left7 * right13 + left11 * right14 + left15 * right15;
if (!defined(result)) {
return new Matrix4(column0Row0, column1Row0, column2Row0, column3Row0,
column0Row1, column1Row1, column2Row1, column3Row1,
column0Row2, column1Row2, column2Row2, column3Row2,
column0Row3, column1Row3, column2Row3, column3Row3);
}
result[0] = column0Row0;
result[1] = column0Row1;
result[2] = column0Row2;
result[3] = column0Row3;
result[4] = column1Row0;
result[5] = column1Row1;
result[6] = column1Row2;
result[7] = column1Row3;
result[8] = column2Row0;
result[9] = column2Row1;
result[10] = column2Row2;
result[11] = column2Row3;
result[12] = column3Row0;
result[13] = column3Row1;
result[14] = column3Row2;
result[15] = column3Row3;
return result;
};
/**
* Multiplies a transformation matrix (with a bottom row of <code>[0.0, 0.0, 0.0, 1.0]</code>)
* by an implicit translation matrix defined by a {@link Cartesian3}. This is an optimization
* for <code>Matrix4.multiply(m, Matrix4.fromTranslation(position), m);</code> with less allocations and arithmetic operations.
*
* @memberof Matrix4
*
* @param {Matrix4} matrix The matrix on the left-hand side.
* @param {Cartesian3} translation The translation on the right-hand side.
* @param {Matrix4} [result] The object onto which to store the result.
*
* @returns {Matrix4} The modified result parameter or a new Matrix4 instance if one was not provided.
*
* @exception {DeveloperError} matrix is required.
* @exception {DeveloperError} translation is required.
*
* @see Matrix4#fromTranslation
*
* @example
* // Instead of Matrix4.multiply(m, Matrix4.fromTranslation(position), m);
* Matrix4.multiplyByTranslation(m, position, m);
*/
Matrix4.multiplyByTranslation = function(matrix, translation, result) {
if (!defined(matrix)) {
throw new DeveloperError('matrix is required');
}
if (!defined(translation)) {
throw new DeveloperError('translation is required');
}
var x = translation.x;
var y = translation.y;
var z = translation.z;
var tx = (x * matrix[0]) + (y * matrix[4]) + (z * matrix[8]) + matrix[12];
var ty = (x * matrix[1]) + (y * matrix[5]) + (z * matrix[9]) + matrix[13];
var tz = (x * matrix[2]) + (y * matrix[6]) + (z * matrix[10]) + matrix[14];
if (!defined(result)) {
return new Matrix4(matrix[0], matrix[4], matrix[8], tx,
matrix[1], matrix[5], matrix[9], ty,
matrix[2], matrix[6], matrix[10], tz,
matrix[3], matrix[7], matrix[11], matrix[15]);
}
result[0] = matrix[0];
result[1] = matrix[1];
result[2] = matrix[2];
result[3] = matrix[3];
result[4] = matrix[4];
result[5] = matrix[5];
result[6] = matrix[6];
result[7] = matrix[7];
result[8] = matrix[8];
result[9] = matrix[9];
result[10] = matrix[10];
result[11] = matrix[11];
result[12] = tx;
result[13] = ty;
result[14] = tz;
result[15] = matrix[15];
return result;
};
/**
* Multiplies a transformation matrix (with a bottom row of <code>[0.0, 0.0, 0.0, 1.0]</code>)
* by an implicit uniform scale matrix. This is an optimization
* for <code>Matrix4.multiply(m, Matrix4.fromScale(scale), m);</code> with less allocations and arithmetic operations.
*
* @memberof Matrix4
*
* @param {Matrix4} matrix The matrix on the left-hand side.
* @param {Number} scale The uniform scale on the right-hand side.
* @param {Matrix4} [result] The object onto which to store the result.
*
* @returns {Matrix4} The modified result parameter or a new Matrix4 instance if one was not provided.
*
* @exception {DeveloperError} matrix is required.
* @exception {DeveloperError} scale is required.
*
* @see Matrix4#fromUniformScale
*
* @example
* // Instead of Matrix4.multiply(m, Matrix4.fromUniformScale(scale), m);
* Matrix4.multiplyByUniformScale(m, scale, m);
*/
Matrix4.multiplyByUniformScale = function(matrix, scale, result) {
if (!defined(matrix)) {
throw new DeveloperError('matrix is required');
}
if (typeof scale !== 'number') {
throw new DeveloperError('scale is required');
}
if (scale === 1.0) {
return Matrix4.clone(matrix, result);
}
if (!defined(result)) {
return new Matrix4(
scale * matrix[0], scale * matrix[4], scale * matrix[8], matrix[12],
scale * matrix[1], scale * matrix[5], scale * matrix[9], matrix[13],
scale * matrix[2], scale * matrix[6], scale * matrix[10], matrix[14],
0.0, 0.0, 0.0, 1.0);
}
result[0] = scale * matrix[0];
result[1] = scale * matrix[1];
result[2] = scale * matrix[2];
result[3] = 0.0;
result[4] = scale * matrix[4];
result[5] = scale * matrix[5];
result[6] = scale * matrix[6];
result[7] = 0.0;
result[8] = scale * matrix[8];
result[9] = scale * matrix[9];
result[10] = scale * matrix[10];
result[11] = 0.0;
result[12] = matrix[12];
result[13] = matrix[13];
result[14] = matrix[14];
result[15] = 1.0;
return result;
};
/**
* Computes the product of a matrix and a column vector.
* @memberof Matrix4
*
* @param {Matrix4} matrix The matrix.
* @param {Cartesian4} cartesian The vector.
* @param {Cartesian4} [result] The object onto which to store the result.
* @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided.
*
* @exception {DeveloperError} matrix is required.
* @exception {DeveloperError} cartesian is required.
*/
Matrix4.multiplyByVector = function(matrix, cartesian, result) {
if (!defined(matrix)) {
throw new DeveloperError('matrix is required');
}
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required');
}
var vX = cartesian.x;
var vY = cartesian.y;
var vZ = cartesian.z;
var vW = cartesian.w;
var x = matrix[0] * vX + matrix[4] * vY + matrix[8] * vZ + matrix[12] * vW;
var y = matrix[1] * vX + matrix[5] * vY + matrix[9] * vZ + matrix[13] * vW;
var z = matrix[2] * vX + matrix[6] * vY + matrix[10] * vZ + matrix[14] * vW;
var w = matrix[3] * vX + matrix[7] * vY + matrix[11] * vZ + matrix[15] * vW;
if (!defined(result)) {
return new Cartesian4(x, y, z, w);
}
result.x = x;
result.y = y;
result.z = z;
result.w = w;
return result;
};
var scratchPoint = new Cartesian4(0.0, 0.0, 0.0, 1.0);
/**
* Computes the product of a matrix and a {@link Cartesian3}. This is equivalent to calling {@link Matrix4.multiplyByVector}
* with a {@link Cartesian4} with a <code>w</code> component of one.
* @memberof Matrix4
*
* @param {Matrix4} matrix The matrix.
* @param {Cartesian3} cartesian The point.
* @param {Cartesian4} [result] The object onto which to store the result.
* @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided.
*
* @exception {DeveloperError} cartesian is required.
* @exception {DeveloperError} matrix is required.
*
* @example
* Cartesian3 p = new Cartesian3(1.0, 2.0, 3.0);
* Matrix4.multiplyByPoint(matrix, p, result);
* // A shortcut for
* // Cartesian3 p = ...
* // Matrix4.multiplyByVector(matrix, new Cartesian4(p.x, p.y, p.z, 1.0), result);
*/
Matrix4.multiplyByPoint = function(matrix, cartesian, result) {
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required');
}
scratchPoint.x = cartesian.x;
scratchPoint.y = cartesian.y;
scratchPoint.z = cartesian.z;
// scratchPoint.w is one. See above.
return Matrix4.multiplyByVector(matrix, scratchPoint, result);
};
/**
* Computes the product of a matrix and a scalar.
* @memberof Matrix4
*
* @param {Matrix4} matrix The matrix.
* @param {Number} scalar The number to multiply by.
* @param {Matrix4} [result] The object onto which to store the result.
* @returns {Matrix4} The modified result parameter or a new Cartesian4 instance if one was not provided.
*
* @exception {DeveloperError} matrix is required.
* @exception {DeveloperError} scalar is required and must be a number.
*
* @example
* //create a Matrix4 instance which is a scaled version of the supplied Matrix4
* // m = [10.0, 11.0, 12.0, 13.0]
* // [14.0, 15.0, 16.0, 17.0]
* // [18.0, 19.0, 20.0, 21.0]
* // [22.0, 23.0, 24.0, 25.0]
*
* var a = Matrix4.multiplyByScalar(m, -2);
*
* // m remains the same
* // a = [-20.0, -22.0, -24.0, -26.0]
* // [-28.0, -30.0, -32.0, -34.0]
* // [-36.0, -38.0, -40.0, -42.0]
* // [-44.0, -46.0, -48.0, -50.0]
*
*/
Matrix4.multiplyByScalar = function(matrix, scalar, result) {
if (!defined(matrix)) {
throw new DeveloperError('matrix is required');
}
if (typeof scalar !== 'number') {
throw new DeveloperError('scalar is required and must be a number');
}
if (!defined(result)) {
return new Matrix4(matrix[0] * scalar, matrix[4] * scalar, matrix[8] * scalar, matrix[12] * scalar,
matrix[1] * scalar, matrix[5] * scalar, matrix[9] * scalar, matrix[13] * scalar,
matrix[2] * scalar, matrix[6] * scalar, matrix[10] * scalar, matrix[14] * scalar,
matrix[3] * scalar, matrix[7] * scalar, matrix[11] * scalar, matrix[15] * scalar);
}
result[0] = matrix[0] * scalar;
result[1] = matrix[1] * scalar;
result[2] = matrix[2] * scalar;
result[3] = matrix[3] * scalar;
result[4] = matrix[4] * scalar;
result[5] = matrix[5] * scalar;
result[6] = matrix[6] * scalar;
result[7] = matrix[7] * scalar;
result[8] = matrix[8] * scalar;
result[9] = matrix[9] * scalar;
result[10] = matrix[10] * scalar;
result[11] = matrix[11] * scalar;
result[12] = matrix[12] * scalar;
result[13] = matrix[13] * scalar;
result[14] = matrix[14] * scalar;
result[15] = matrix[15] * scalar;
return result;
};
/**
* Computes a negated copy of the provided matrix.
* @memberof Matrix4
*
* @param {Matrix4} matrix The matrix to negate.
* @param {Matrix4} [result] The object onto which to store the result.
* @returns {Matrix4} The modified result parameter or a new Matrix4 instance if one was not provided.
*
* @exception {DeveloperError} matrix is required.
*
* @example
* //create a new Matrix4 instance which is a negation of a Matrix4
* // m = [10.0, 11.0, 12.0, 13.0]
* // [14.0, 15.0, 16.0, 17.0]
* // [18.0, 19.0, 20.0, 21.0]
* // [22.0, 23.0, 24.0, 25.0]
*
* var a = Matrix4.negate(m);
*
* // m remains the same
* // a = [-10.0, -11.0, -12.0, -13.0]
* // [-14.0, -15.0, -16.0, -17.0]
* // [-18.0, -19.0, -20.0, -21.0]
* // [-22.0, -23.0, -24.0, -25.0]
*
*/
Matrix4.negate = function(matrix, result) {
if (!defined(matrix)) {
throw new DeveloperError('matrix is required');
}
if (!defined(result)) {
return new Matrix4(-matrix[0], -matrix[4], -matrix[8], -matrix[12],
-matrix[1], -matrix[5], -matrix[9], -matrix[13],
-matrix[2], -matrix[6], -matrix[10], -matrix[14],
-matrix[3], -matrix[7], -matrix[11], -matrix[15]);
}
result[0] = -matrix[0];
result[1] = -matrix[1];
result[2] = -matrix[2];
result[3] = -matrix[3];
result[4] = -matrix[4];
result[5] = -matrix[5];
result[6] = -matrix[6];
result[7] = -matrix[7];
result[8] = -matrix[8];
result[9] = -matrix[9];
result[10] = -matrix[10];
result[11] = -matrix[11];
result[12] = -matrix[12];
result[13] = -matrix[13];
result[14] = -matrix[14];
result[15] = -matrix[15];
return result;
};
/**
* Computes the transpose of the provided matrix.
* @memberof Matrix4
*
* @param {Matrix4} matrix The matrix to transpose.
* @param {Matrix4} [result] The object onto which to store the result.
* @returns {Matrix4} The modified result parameter or a new Matrix4 instance if one was not provided.
*
* @exception {DeveloperError} matrix is required.
*
* @example
* //returns transpose of a Matrix4
* // m = [10.0, 11.0, 12.0, 13.0]
* // [14.0, 15.0, 16.0, 17.0]
* // [18.0, 19.0, 20.0, 21.0]
* // [22.0, 23.0, 24.0, 25.0]
*
* var a = Matrix4.negate(m);
*
* // m remains the same
* // a = [10.0, 14.0, 18.0, 22.0]
* // [11.0, 15.0, 19.0, 23.0]
* // [12.0, 16.0, 20.0, 24.0]
* // [13.0, 17.0, 21.0, 25.0]
*
*/
Matrix4.transpose = function(matrix, result) {
if (!defined(matrix)) {
throw new DeveloperError('matrix is required');
}
if (!defined(result)) {
return new Matrix4(matrix[0], matrix[1], matrix[2], matrix[3],
matrix[4], matrix[5], matrix[6], matrix[7],
matrix[8], matrix[9], matrix[10], matrix[11],
matrix[12], matrix[13], matrix[14], matrix[15]);
}
var matrix1 = matrix[1];
var matrix2 = matrix[2];
var matrix3 = matrix[3];
var matrix6 = matrix[6];
var matrix7 = matrix[7];
var matrix11 = matrix[11];
result[0] = matrix[0];
result[1] = matrix[4];
result[2] = matrix[8];
result[3] = matrix[12];
result[4] = matrix1;
result[5] = matrix[5];
result[6] = matrix[9];
result[7] = matrix[13];
result[8] = matrix2;
result[9] = matrix6;
result[10] = matrix[10];
result[11] = matrix[14];
result[12] = matrix3;
result[13] = matrix7;
result[14] = matrix11;
result[15] = matrix[15];
return result;
};
/**
* Compares the provided matrices componentwise and returns
* <code>true</code> if they are equal, <code>false</code> otherwise.
* @memberof Matrix4
*
* @param {Matrix4} [left] The first matrix.
* @param {Matrix4} [right] The second matrix.
* @returns {Boolean} <code>true</code> if left and right are equal, <code>false</code> otherwise.
*
* @example
* //compares two Matrix4 instances
*
* // a = [10.0, 14.0, 18.0, 22.0]
* // [11.0, 15.0, 19.0, 23.0]
* // [12.0, 16.0, 20.0, 24.0]
* // [13.0, 17.0, 21.0, 25.0]
*
* // b = [10.0, 14.0, 18.0, 22.0]
* // [11.0, 15.0, 19.0, 23.0]
* // [12.0, 16.0, 20.0, 24.0]
* // [13.0, 17.0, 21.0, 25.0]
*
* if(Matrix4.equals(a,b)) {
* console.log("Both matrices are equal");
* } else {
* console.log("They are not equal");
* }
*
* //Prints "Both matrices are equal" on the console
*
*/
Matrix4.equals = function(left, right) {
return (left === right) ||
(defined(left) &&
defined(right) &&
left[0] === right[0] &&
left[1] === right[1] &&
left[2] === right[2] &&
left[3] === right[3] &&
left[4] === right[4] &&
left[5] === right[5] &&
left[6] === right[6] &&
left[7] === right[7] &&
left[8] === right[8] &&
left[9] === right[9] &&
left[10] === right[10] &&
left[11] === right[11] &&
left[12] === right[12] &&
left[13] === right[13] &&
left[14] === right[14] &&
left[15] === right[15]);
};
/**
* Compares the provided matrices componentwise and returns
* <code>true</code> if they are within the provided epsilon,
* <code>false</code> otherwise.
* @memberof Matrix4
*
* @param {Matrix4} [left] The first matrix.
* @param {Matrix4} [right] The second matrix.
* @param {Number} epsilon The epsilon to use for equality testing.
* @returns {Boolean} <code>true</code> if left and right are within the provided epsilon, <code>false</code> otherwise.
*
* @exception {DeveloperError} epsilon is required and must be a number.
*
* @example
* //compares two Matrix4 instances
*
* // a = [10.5, 14.5, 18.5, 22.5]
* // [11.5, 15.5, 19.5, 23.5]
* // [12.5, 16.5, 20.5, 24.5]
* // [13.5, 17.5, 21.5, 25.5]
*
* // b = [10.0, 14.0, 18.0, 22.0]
* // [11.0, 15.0, 19.0, 23.0]
* // [12.0, 16.0, 20.0, 24.0]
* // [13.0, 17.0, 21.0, 25.0]
*
* if(Matrix4.equalsEpsilon(a,b,0.1)){
* console.log("Difference between both the matrices is less than 0.1");
* } else {
* console.log("Difference between both the matrices is not less than 0.1");
* }
*
* //Prints "Difference between both the matrices is not less than 0.1" on the console
*
*/
Matrix4.equalsEpsilon = function(left, right, epsilon) {
if (typeof epsilon !== 'number') {
throw new DeveloperError('epsilon is required and must be a number');
}
return (left === right) ||
(defined(left) &&
defined(right) &&
Math.abs(left[0] - right[0]) <= epsilon &&
Math.abs(left[1] - right[1]) <= epsilon &&
Math.abs(left[2] - right[2]) <= epsilon &&
Math.abs(left[3] - right[3]) <= epsilon &&
Math.abs(left[4] - right[4]) <= epsilon &&
Math.abs(left[5] - right[5]) <= epsilon &&
Math.abs(left[6] - right[6]) <= epsilon &&
Math.abs(left[7] - right[7]) <= epsilon &&
Math.abs(left[8] - right[8]) <= epsilon &&
Math.abs(left[9] - right[9]) <= epsilon &&
Math.abs(left[10] - right[10]) <= epsilon &&
Math.abs(left[11] - right[11]) <= epsilon &&
Math.abs(left[12] - right[12]) <= epsilon &&
Math.abs(left[13] - right[13]) <= epsilon &&
Math.abs(left[14] - right[14]) <= epsilon &&
Math.abs(left[15] - right[15]) <= epsilon);
};
/**
* Gets the translation portion of the provided matrix, assuming the matrix is a affine transformation matrix.
* @memberof Matrix4
*
* @param {Matrix4} matrix The matrix to use.
* @param {Cartesian3} [result] The object onto which to store the result.
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided.
*
* @exception {DeveloperError} matrix is required.
*
* @see Cartesian3
*/
Matrix4.getTranslation = function(matrix, result) {
if (!defined(matrix)) {
throw new DeveloperError('matrix is required');
}
if (!defined(result)) {
return new Cartesian3(matrix[12], matrix[13], matrix[14]);
}
result.x = matrix[12];
result.y = matrix[13];
result.z = matrix[14];
return result;
};
/**
* Gets the upper left 3x3 rotation matrix of the provided matrix, assuming the matrix is a affine transformation matrix.
* @memberof Matrix4
*
* @param {Matrix4} matrix The matrix to use.
* @param {Matrix3} [result] The object onto which to store the result.
* @returns {Matrix3} The modified result parameter or a new Cartesian3 instance if one was not provided.
*
* @exception {DeveloperError} matrix is required.
*
* @see Matrix3
*
* @example
* // returns a Matrix3 instance from a Matrix4 instance
*
* // m = [10.0, 14.0, 18.0, 22.0]
* // [11.0, 15.0, 19.0, 23.0]
* // [12.0, 16.0, 20.0, 24.0]
* // [13.0, 17.0, 21.0, 25.0]
*
* var b = new Matrix3();
* Matrix4.getRotation(m,b);
*
* // b = [10.0, 14.0, 18.0]
* // [11.0, 15.0, 19.0]
* // [12.0, 16.0, 20.0]
*
*/
Matrix4.getRotation = function(matrix, result) {
if (!defined(matrix)) {
throw new DeveloperError('matrix is required');
}
if (!defined(result)) {
return new Matrix3(matrix[0], matrix[4], matrix[8],
matrix[1], matrix[5], matrix[9],
matrix[2], matrix[6], matrix[10]);
}
result[0] = matrix[0];
result[1] = matrix[1];
result[2] = matrix[2];
result[3] = matrix[4];
result[4] = matrix[5];
result[5] = matrix[6];
result[6] = matrix[8];
result[7] = matrix[9];
result[8] = matrix[10];
return result;
};
/**
* Computes the inverse of the provided matrix using Cramers Rule.
* If the determinant is zero, the matrix can not be inverted, and an exception is thrown.
* If the matrix is an affine transformation matrix, it is more efficient
* to invert it with {@link #inverseTransformation}.
* @memberof Matrix4
*
* @param {Matrix4} matrix The matrix to invert.
* @param {Matrix4} [result] The object onto which to store the result.
* @returns {Matrix4} The modified result parameter or a new Cartesian3 instance if one was not provided.
*
* @exception {DeveloperError} matrix is required.
* @exception {RuntimeError} matrix is not invertible because its determinate is zero.
*/
Matrix4.inverse = function(matrix, result) {
if (!defined(matrix)) {
throw new DeveloperError('matrix is required');
}
//
// Ported from:
// ftp://download.intel.com/design/PentiumIII/sml/24504301.pdf
//
var src0 = matrix[0];
var src1 = matrix[4];
var src2 = matrix[8];
var src3 = matrix[12];
var src4 = matrix[1];
var src5 = matrix[5];
var src6 = matrix[9];
var src7 = matrix[13];
var src8 = matrix[2];
var src9 = matrix[6];
var src10 = matrix[10];
var src11 = matrix[14];
var src12 = matrix[3];
var src13 = matrix[7];
var src14 = matrix[11];
var src15 = matrix[15];
// calculate pairs for first 8 elements (cofactors)
var tmp0 = src10 * src15;
var tmp1 = src11 * src14;
var tmp2 = src9 * src15;
var tmp3 = src11 * src13;
var tmp4 = src9 * src14;
var tmp5 = src10 * src13;
var tmp6 = src8 * src15;
var tmp7 = src11 * src12;
var tmp8 = src8 * src14;
var tmp9 = src10 * src12;
var tmp10 = src8 * src13;
var tmp11 = src9 * src12;
// calculate first 8 elements (cofactors)
var dst0 = (tmp0 * src5 + tmp3 * src6 + tmp4 * src7) - (tmp1 * src5 + tmp2 * src6 + tmp5 * src7);
var dst1 = (tmp1 * src4 + tmp6 * src6 + tmp9 * src7) - (tmp0 * src4 + tmp7 * src6 + tmp8 * src7);
var dst2 = (tmp2 * src4 + tmp7 * src5 + tmp10 * src7) - (tmp3 * src4 + tmp6 * src5 + tmp11 * src7);
var dst3 = (tmp5 * src4 + tmp8 * src5 + tmp11 * src6) - (tmp4 * src4 + tmp9 * src5 + tmp10 * src6);
var dst4 = (tmp1 * src1 + tmp2 * src2 + tmp5 * src3) - (tmp0 * src1 + tmp3 * src2 + tmp4 * src3);
var dst5 = (tmp0 * src0 + tmp7 * src2 + tmp8 * src3) - (tmp1 * src0 + tmp6 * src2 + tmp9 * src3);
var dst6 = (tmp3 * src0 + tmp6 * src1 + tmp11 * src3) - (tmp2 * src0 + tmp7 * src1 + tmp10 * src3);
var dst7 = (tmp4 * src0 + tmp9 * src1 + tmp10 * src2) - (tmp5 * src0 + tmp8 * src1 + tmp11 * src2);
// calculate pairs for second 8 elements (cofactors)
tmp0 = src2 * src7;
tmp1 = src3 * src6;
tmp2 = src1 * src7;
tmp3 = src3 * src5;
tmp4 = src1 * src6;
tmp5 = src2 * src5;
tmp6 = src0 * src7;
tmp7 = src3 * src4;
tmp8 = src0 * src6;
tmp9 = src2 * src4;
tmp10 = src0 * src5;
tmp11 = src1 * src4;
// calculate second 8 elements (cofactors)
var dst8 = (tmp0 * src13 + tmp3 * src14 + tmp4 * src15) - (tmp1 * src13 + tmp2 * src14 + tmp5 * src15);
var dst9 = (tmp1 * src12 + tmp6 * src14 + tmp9 * src15) - (tmp0 * src12 + tmp7 * src14 + tmp8 * src15);
var dst10 = (tmp2 * src12 + tmp7 * src13 + tmp10 * src15) - (tmp3 * src12 + tmp6 * src13 + tmp11 * src15);
var dst11 = (tmp5 * src12 + tmp8 * src13 + tmp11 * src14) - (tmp4 * src12 + tmp9 * src13 + tmp10 * src14);
var dst12 = (tmp2 * src10 + tmp5 * src11 + tmp1 * src9) - (tmp4 * src11 + tmp0 * src9 + tmp3 * src10);
var dst13 = (tmp8 * src11 + tmp0 * src8 + tmp7 * src10) - (tmp6 * src10 + tmp9 * src11 + tmp1 * src8);
var dst14 = (tmp6 * src9 + tmp11 * src11 + tmp3 * src8) - (tmp10 * src11 + tmp2 * src8 + tmp7 * src9);
var dst15 = (tmp10 * src10 + tmp4 * src8 + tmp9 * src9) - (tmp8 * src9 + tmp11 * src10 + tmp5 * src8);
// calculate determinant
var det = src0 * dst0 + src1 * dst1 + src2 * dst2 + src3 * dst3;
if (Math.abs(det) < CesiumMath.EPSILON20) {
throw new RuntimeError('matrix is not invertible because its determinate is zero.');
}
// calculate matrix inverse
det = 1.0 / det;
if (!defined(result)) {
return new Matrix4(dst0 * det, dst4 * det, dst8 * det, dst12 * det,
dst1 * det, dst5 * det, dst9 * det, dst13 * det,
dst2 * det, dst6 * det, dst10 * det, dst14 * det,
dst3 * det, dst7 * det, dst11 * det, dst15 * det);
}
result[0] = dst0 * det;
result[1] = dst1 * det;
result[2] = dst2 * det;
result[3] = dst3 * det;
result[4] = dst4 * det;
result[5] = dst5 * det;
result[6] = dst6 * det;
result[7] = dst7 * det;
result[8] = dst8 * det;
result[9] = dst9 * det;
result[10] = dst10 * det;
result[11] = dst11 * det;
result[12] = dst12 * det;
result[13] = dst13 * det;
result[14] = dst14 * det;
result[15] = dst15 * det;
return result;
};
/**
* Computes the inverse of the provided matrix assuming it is
* an affine transformation matrix, where the upper left 3x3 elements
* are a rotation matrix, and the upper three elements in the fourth
* column are the translation. The bottom row is assumed to be [0, 0, 0, 1].
* The matrix is not verified to be in the proper form.
* This method is faster than computing the inverse for a general 4x4
* matrix using {@link #inverse}.
* @memberof Matrix4
*
* @param {Matrix4} matrix The matrix to invert.
* @param {Matrix4} [result] The object onto which to store the result.
* @returns {Matrix4} The modified result parameter or a new Cartesian3 instance if one was not provided.
*
* @exception {DeveloperError} matrix is required.
*/
Matrix4.inverseTransformation = function(matrix, result) {
if (!defined(matrix)) {
throw new DeveloperError('matrix is required');
}
//This function is an optimized version of the below 4 lines.
//var rT = Matrix3.transpose(Matrix4.getRotation(matrix));
//var rTN = Matrix3.negate(rT);
//var rTT = Matrix3.multiplyByVector(rTN, Matrix4.getTranslation(matrix));
//return Matrix4.fromRotationTranslation(rT, rTT, result);
var matrix0 = matrix[0];
var matrix1 = matrix[1];
var matrix2 = matrix[2];
var matrix4 = matrix[4];
var matrix5 = matrix[5];
var matrix6 = matrix[6];
var matrix8 = matrix[8];
var matrix9 = matrix[9];
var matrix10 = matrix[10];
var vX = matrix[12];
var vY = matrix[13];
var vZ = matrix[14];
var x = -matrix0 * vX - matrix1 * vY - matrix2 * vZ;
var y = -matrix4 * vX - matrix5 * vY - matrix6 * vZ;
var z = -matrix8 * vX - matrix9 * vY - matrix10 * vZ;
if (!defined(result)) {
return new Matrix4(matrix0, matrix1, matrix2, x,
matrix4, matrix5, matrix6, y,
matrix8, matrix9, matrix10, z,
0.0, 0.0, 0.0, 1.0);
}
result[0] = matrix0;
result[1] = matrix4;
result[2] = matrix8;
result[3] = 0.0;
result[4] = matrix1;
result[5] = matrix5;
result[6] = matrix9;
result[7] = 0.0;
result[8] = matrix2;
result[9] = matrix6;
result[10] = matrix10;
result[11] = 0.0;
result[12] = x;
result[13] = y;
result[14] = z;
result[15] = 1.0;
return result;
};
/**
* An immutable Matrix4 instance initialized to the identity matrix.
* @memberof Matrix4
*/
Matrix4.IDENTITY = freezeObject(new Matrix4(1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0));
/**
* The index into Matrix4 for column 0, row 0.
* @memberof Matrix4
*/
Matrix4.COLUMN0ROW0 = 0;
/**
* The index into Matrix4 for column 0, row 1.
* @memberof Matrix4
*/
Matrix4.COLUMN0ROW1 = 1;
/**
* The index into Matrix4 for column 0, row 2.
* @memberof Matrix4
*/
Matrix4.COLUMN0ROW2 = 2;
/**
* The index into Matrix4 for column 0, row 3.
* @memberof Matrix4
*/
Matrix4.COLUMN0ROW3 = 3;
/**
* The index into Matrix4 for column 1, row 0.
* @memberof Matrix4
*/
Matrix4.COLUMN1ROW0 = 4;
/**
* The index into Matrix4 for column 1, row 1.
* @memberof Matrix4
*/
Matrix4.COLUMN1ROW1 = 5;
/**
* The index into Matrix4 for column 1, row 2.
* @memberof Matrix4
*/
Matrix4.COLUMN1ROW2 = 6;
/**
* The index into Matrix4 for column 1, row 3.
* @memberof Matrix4
*/
Matrix4.COLUMN1ROW3 = 7;
/**
* The index into Matrix4 for column 2, row 0.
* @memberof Matrix4
*/
Matrix4.COLUMN2ROW0 = 8;
/**
* The index into Matrix4 for column 2, row 1.
* @memberof Matrix4
*/
Matrix4.COLUMN2ROW1 = 9;
/**
* The index into Matrix4 for column 2, row 2.
* @memberof Matrix4
*/
Matrix4.COLUMN2ROW2 = 10;
/**
* The index into Matrix4 for column 2, row 3.
* @memberof Matrix4
*/
Matrix4.COLUMN2ROW3 = 11;
/**
* The index into Matrix4 for column 3, row 0.
* @memberof Matrix4
*/
Matrix4.COLUMN3ROW0 = 12;
/**
* The index into Matrix4 for column 3, row 1.
* @memberof Matrix4
*/
Matrix4.COLUMN3ROW1 = 13;
/**
* The index into Matrix4 for column 3, row 2.
* @memberof Matrix4
*/
Matrix4.COLUMN3ROW2 = 14;
/**
* The index into Matrix4 for column 3, row 3.
* @memberof Matrix4
*/
Matrix4.COLUMN3ROW3 = 15;
/**
* Duplicates the provided Matrix4 instance.
* @memberof Matrix4
*
* @param {Matrix4} [result] The object onto which to store the result.
* @returns {Matrix4} The modified result parameter or a new Matrix4 instance if one was not provided.
*/
Matrix4.prototype.clone = function(result) {
return Matrix4.clone(this, result);
};
/**
* Computes an Array from this Matrix4 instance.
* @memberof Matrix4
*
* @param {Array} [result] The Array onto which to store the result.
* @returns {Array} The modified Array parameter or a new Array instance if one was not provided.
*/
Matrix4.prototype.toArray = function(result) {
return Matrix4.toArray(this, result);
};
/**
* Retrieves a copy of the matrix column at the provided index as a Cartesian4 instance.
* @memberof Matrix4
*
* @param {Number} index The zero-based index of the column to retrieve.
* @param {Cartesian4} [result] The object onto which to store the result.
* @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided.
*
* @exception {DeveloperError} index is required and must be 0, 1, 2, or 3.
*
* @see Cartesian4
*/
Matrix4.prototype.getColumn = function(index, result) {
return Matrix4.getColumn(this, index, result);
};
/**
* Computes a new matrix that replaces the specified column in this matrix with the provided Cartesian4 instance.
* @memberof Matrix4
*
* @param {Number} index The zero-based index of the column to set.
* @param {Cartesian4} cartesian The Cartesian whose values will be assigned to the specified column.
*
* @exception {DeveloperError} cartesian is required.
* @exception {DeveloperError} index is required and must be 0, 1, 2, or 3.
*
* @see Cartesian4
*/
Matrix4.prototype.setColumn = function(index, cartesian, result) {
return Matrix4.setColumn(this, index, cartesian, result);
};
/**
* Retrieves a copy of the matrix row at the provided index as a Cartesian4 instance.
* @memberof Matrix4
*
* @param {Number} index The zero-based index of the row to retrieve.
* @param {Cartesian4} [result] The object onto which to store the result.
* @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided.
*
* @exception {DeveloperError} index is required and must be 0, 1, 2, or 3.
*
* @see Cartesian4
*/
Matrix4.prototype.getRow = function(index, result) {
return Matrix4.getRow(this, index, result);
};
/**
* Computes a new matrix that replaces the specified row in this matrix with the provided Cartesian4 instance.
* @memberof Matrix4
*
* @param {Number} index The zero-based index of the row to set.
* @param {Cartesian4} cartesian The Cartesian whose values will be assigned to the specified row.
*
* @exception {DeveloperError} cartesian is required.
* @exception {DeveloperError} index is required and must be 0, 1, 2, or 3.
*
* @see Cartesian4
*/
Matrix4.prototype.setRow = function(index, cartesian, result) {
return Matrix4.setRow(this, index, cartesian, result);
};
/**
* Computes the product of this matrix and the provided matrix.
* @memberof Matrix4
*
* @param {Matrix4} right The right hand side matrix.
* @param {Matrix4} [result] The object onto which to store the result.
* @returns {Matrix4} The modified result parameter or a new Matrix4 instance if one was not provided.
*
* @exception {DeveloperError} right is required.
*/
Matrix4.prototype.multiply = function(right, result) {
return Matrix4.multiply(this, right, result);
};
/**
* Multiplies this matrix, assuming it is a transformation matrix (with a bottom row of
* <code>[0.0, 0.0, 0.0, 1.0]</code>), by an implicit translation matrix defined by a {@link Cartesian3}.
*
* @memberof Matrix4
*
* @param {Cartesian3} translation The translation on the right-hand side of the multiplication.
* @param {Matrix4} [result] The object onto which to store the result.
*
* @returns {Matrix4} The modified result parameter or a new Matrix4 instance if one was not provided.
*
* @exception {DeveloperError} translation is required.
*/
Matrix4.prototype.multiplyByTranslation = function(translation, result) {
return Matrix4.multiplyByTranslation(this, translation, result);
};
/**
* Multiplies this matrix, assuming it is a transformation matrix (with a bottom row of
* <code>[0.0, 0.0, 0.0, 1.0]</code>), by an implicit uniform scale matrix.
*
* @memberof Matrix4
*
* @param {Number} scale The scale on the right-hand side of the multiplication.
* @param {Matrix4} [result] The object onto which to store the result.
*
* @returns {Matrix4} The modified result parameter or a new Matrix4 instance if one was not provided.
*
* @exception {DeveloperError} scale is required.
*/
Matrix4.prototype.multiplyByUniformScale = function(scale, result) {
return Matrix4.multiplyByUniformScale(this, scale, result);
};
/**
* Computes the product of this matrix and a column vector.
* @memberof Matrix4
*
* @param {Cartesian4} cartesian The vector.
* @param {Cartesian4} [result] The object onto which to store the result.
* @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided.
*
* @exception {DeveloperError} cartesian is required.
*/
Matrix4.prototype.multiplyByVector = function(cartesian, result) {
return Matrix4.multiplyByVector(this, cartesian, result);
};
/**
* Computes the product of a matrix and a {@link Cartesian3}. This is equivalent to calling {@link Matrix4#multiplyByVector}
* with a {@link Cartesian4} with a <code>w</code> component of one.
* @memberof Matrix4
*
* @param {Cartesian3} cartesian The point.
* @param {Cartesian4} [result] The object onto which to store the result.
* @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided.
*
* @exception {DeveloperError} cartesian is required.
*/
Matrix4.prototype.multiplyByPoint = function(cartesian, result) {
return Matrix4.multiplyByPoint(this, cartesian, result);
};
/**
* Computes the product of this matrix and a scalar.
* @memberof Matrix4
*
* @param {Number} scalar The number to multiply by.
* @param {Matrix4} [result] The object onto which to store the result.
* @returns {Matrix4} The modified result parameter or a new Cartesian4 instance if one was not provided.
*
* @exception {DeveloperError} scalar is required and must be a number.
*/
Matrix4.prototype.multiplyByScalar = function(scalar, result) {
return Matrix4.multiplyByScalar(this, scalar, result);
};
/**
* Computes a negated copy of this matrix.
* @memberof Matrix4
*
* @param {Matrix4} matrix The matrix to negate.
* @param {Matrix4} [result] The object onto which to store the result.
* @returns {Matrix4} The modified result parameter or a new Matrix4 instance if one was not provided.
*
* @exception {DeveloperError} matrix is required.
*/
Matrix4.prototype.negate = function(result) {
return Matrix4.negate(this, result);
};
/**
* Computes the transpose of this matrix.
* @memberof Matrix4
*
* @param {Matrix4} [result] The object onto which to store the result.
* @returns {Matrix4} The modified result parameter or a new Matrix4 instance if one was not provided.
*/
Matrix4.prototype.transpose = function(result) {
return Matrix4.transpose(this, result);
};
/**
* Compares this matrix to the provided matrix componentwise and returns
* <code>true</code> if they are equal, <code>false</code> otherwise.
* @memberof Matrix4
*
* @param {Matrix4} [right] The right hand side matrix.
* @returns {Boolean} <code>true</code> if they are equal, <code>false</code> otherwise.
*/
Matrix4.prototype.equals = function(right) {
return Matrix4.equals(this, right);
};
/**
* Compares this matrix to the provided matrix componentwise and returns
* <code>true</code> if they are within the provided epsilon,
* <code>false</code> otherwise.
* @memberof Matrix4
*
* @param {Matrix4} [right] The right hand side matrix.
* @param {Number} epsilon The epsilon to use for equality testing.
* @returns {Boolean} <code>true</code> if they are within the provided epsilon, <code>false</code> otherwise.
*
* @exception {DeveloperError} epsilon is required and must be a number.
*/
Matrix4.prototype.equalsEpsilon = function(right, epsilon) {
return Matrix4.equalsEpsilon(this, right, epsilon);
};
/**
* Computes a string representing this Matrix with each row being
* on a separate line and in the format '(column0, column1, column2, column3)'.
* @memberof Matrix4
*
* @returns {String} A string representing the provided Matrix with each row being on a separate line and in the format '(column0, column1, column2, column3)'.
*/
Matrix4.prototype.toString = function() {
return '(' + this[0] + ', ' + this[4] + ', ' + this[8] + ', ' + this[12] +')\n' +
'(' + this[1] + ', ' + this[5] + ', ' + this[9] + ', ' + this[13] +')\n' +
'(' + this[2] + ', ' + this[6] + ', ' + this[10] + ', ' + this[14] +')\n' +
'(' + this[3] + ', ' + this[7] + ', ' + this[11] + ', ' + this[15] +')';
};
/**
* Gets the translation portion of this matrix, assuming the matrix is a affine transformation matrix.
* @memberof Matrix4
*
* @param {Cartesian3} [result] The object onto which to store the result.
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided.
*
* @see Cartesian3
*/
Matrix4.prototype.getTranslation = function(result) {
return Matrix4.getTranslation(this, result);
};
/**
* Gets the upper left 3x3 rotation matrix of this matrix, assuming the matrix is a affine transformation matrix.
* @memberof Matrix4
*
* @param {Matrix3} [result] The object onto which to store the result.
* @returns {Matrix3} The modified result parameter or a new Cartesian3 instance if one was not provided.
*
* @see Matrix3
*/
Matrix4.prototype.getRotation = function(result) {
return Matrix4.getRotation(this, result);
};
/**
* Computes the inverse of this matrix using Cramers Rule.
* If the determinant is zero, the matrix can not be inverted, and an exception is thrown.
* If the matrix is an affine transformation matrix, it is more efficient
* to invert it with {@link #inverseTransformation}.
* @memberof Matrix4
*
* @param {Matrix4} [result] The object onto which to store the result.
* @returns {Matrix4} The modified result parameter or a new Cartesian3 instance if one was not provided.
*
* @exception {RuntimeError} matrix is not invertible because its determinate is zero.
*/
Matrix4.prototype.inverse = function(result) {
return Matrix4.inverse(this, result);
};
/**
* Computes the inverse of this matrix assuming it is
* an affine transformation matrix, where the upper left 3x3 elements
* are a rotation matrix, and the upper three elements in the fourth
* column are the translation. The bottom row is assumed to be [0, 0, 0, 1].
* The matrix is not verified to be in the proper form.
* This method is faster than computing the inverse for a general 4x4
* matrix using {@link #inverse}.
* @memberof Matrix4
*
* @param {Matrix4} [result] The object onto which to store the result.
* @returns {Matrix4} The modified result parameter or a new Cartesian3 instance if one was not provided.
*/
Matrix4.prototype.inverseTransformation = function(result) {
return Matrix4.inverseTransformation(this, result);
};
return Matrix4;
});
/*global define*/
define('Core/BoundingSphere',[
'./defaultValue',
'./defined',
'./DeveloperError',
'./Cartesian3',
'./Cartesian4',
'./Cartographic',
'./Ellipsoid',
'./GeographicProjection',
'./Intersect',
'./Interval',
'./Matrix4'
], function(
defaultValue,
defined,
DeveloperError,
Cartesian3,
Cartesian4,
Cartographic,
Ellipsoid,
GeographicProjection,
Intersect,
Interval,
Matrix4) {
"use strict";
/**
* A bounding sphere with a center and a radius.
* @alias BoundingSphere
* @constructor
*
* @param {Cartesian3} [center=Cartesian3.ZERO] The center of the bounding sphere.
* @param {Number} [radius=0.0] The radius of the bounding sphere.
*
* @see AxisAlignedBoundingBox
* @see BoundingRectangle
*/
var BoundingSphere = function(center, radius) {
/**
* The center point of the sphere.
* @type {Cartesian3}
* @default {@link Cartesian3.ZERO}
*/
this.center = Cartesian3.clone(defaultValue(center, Cartesian3.ZERO));
/**
* The radius of the sphere.
* @type {Number}
* @default 0.0
*/
this.radius = defaultValue(radius, 0.0);
};
var fromPointsXMin = new Cartesian3();
var fromPointsYMin = new Cartesian3();
var fromPointsZMin = new Cartesian3();
var fromPointsXMax = new Cartesian3();
var fromPointsYMax = new Cartesian3();
var fromPointsZMax = new Cartesian3();
var fromPointsCurrentPos = new Cartesian3();
var fromPointsScratch = new Cartesian3();
var fromPointsRitterCenter = new Cartesian3();
var fromPointsMinBoxPt = new Cartesian3();
var fromPointsMaxBoxPt = new Cartesian3();
var fromPointsNaiveCenterScratch = new Cartesian3();
/**
* Computes a tight-fitting bounding sphere enclosing a list of 3D Cartesian points.
* The bounding sphere is computed by running two algorithms, a naive algorithm and
* Ritter's algorithm. The smaller of the two spheres is used to ensure a tight fit.
* @memberof BoundingSphere
*
* @param {Array} positions An array of points that the bounding sphere will enclose. Each point must have <code>x</code>, <code>y</code>, and <code>z</code> properties.
* @param {BoundingSphere} [result] The object onto which to store the result.
* @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if one was not provided.
*
* @see <a href='http://blogs.agi.com/insight3d/index.php/2008/02/04/a-bounding/'>Bounding Sphere computation article</a>
*/
BoundingSphere.fromPoints = function(positions, result) {
if (!defined(result)) {
result = new BoundingSphere();
}
if (!defined(positions) || positions.length === 0) {
result.center = Cartesian3.clone(Cartesian3.ZERO, result.center);
result.radius = 0.0;
return result;
}
var currentPos = Cartesian3.clone(positions[0], fromPointsCurrentPos);
var xMin = Cartesian3.clone(currentPos, fromPointsXMin);
var yMin = Cartesian3.clone(currentPos, fromPointsYMin);
var zMin = Cartesian3.clone(currentPos, fromPointsZMin);
var xMax = Cartesian3.clone(currentPos, fromPointsXMax);
var yMax = Cartesian3.clone(currentPos, fromPointsYMax);
var zMax = Cartesian3.clone(currentPos, fromPointsZMax);
var numPositions = positions.length;
for ( var i = 1; i < numPositions; i++) {
Cartesian3.clone(positions[i], currentPos);
var x = currentPos.x;
var y = currentPos.y;
var z = currentPos.z;
// Store points containing the the smallest and largest components
if (x < xMin.x) {
Cartesian3.clone(currentPos, xMin);
}
if (x > xMax.x) {
Cartesian3.clone(currentPos, xMax);
}
if (y < yMin.y) {
Cartesian3.clone(currentPos, yMin);
}
if (y > yMax.y) {
Cartesian3.clone(currentPos, yMax);
}
if (z < zMin.z) {
Cartesian3.clone(currentPos, zMin);
}
if (z > zMax.z) {
Cartesian3.clone(currentPos, zMax);
}
}
// Compute x-, y-, and z-spans (Squared distances b/n each component's min. and max.).
var xSpan = Cartesian3.magnitudeSquared(Cartesian3.subtract(xMax, xMin, fromPointsScratch));
var ySpan = Cartesian3.magnitudeSquared(Cartesian3.subtract(yMax, yMin, fromPointsScratch));
var zSpan = Cartesian3.magnitudeSquared(Cartesian3.subtract(zMax, zMin, fromPointsScratch));
// Set the diameter endpoints to the largest span.
var diameter1 = xMin;
var diameter2 = xMax;
var maxSpan = xSpan;
if (ySpan > maxSpan) {
maxSpan = ySpan;
diameter1 = yMin;
diameter2 = yMax;
}
if (zSpan > maxSpan) {
maxSpan = zSpan;
diameter1 = zMin;
diameter2 = zMax;
}
// Calculate the center of the initial sphere found by Ritter's algorithm
var ritterCenter = fromPointsRitterCenter;
ritterCenter.x = (diameter1.x + diameter2.x) * 0.5;
ritterCenter.y = (diameter1.y + diameter2.y) * 0.5;
ritterCenter.z = (diameter1.z + diameter2.z) * 0.5;
// Calculate the radius of the initial sphere found by Ritter's algorithm
var radiusSquared = Cartesian3.magnitudeSquared(Cartesian3.subtract(diameter2, ritterCenter, fromPointsScratch));
var ritterRadius = Math.sqrt(radiusSquared);
// Find the center of the sphere found using the Naive method.
var minBoxPt = fromPointsMinBoxPt;
minBoxPt.x = xMin.x;
minBoxPt.y = yMin.y;
minBoxPt.z = zMin.z;
var maxBoxPt = fromPointsMaxBoxPt;
maxBoxPt.x = xMax.x;
maxBoxPt.y = yMax.y;
maxBoxPt.z = zMax.z;
var naiveCenter = Cartesian3.multiplyByScalar(Cartesian3.add(minBoxPt, maxBoxPt, fromPointsScratch), 0.5, fromPointsNaiveCenterScratch);
// Begin 2nd pass to find naive radius and modify the ritter sphere.
var naiveRadius = 0;
for (i = 0; i < numPositions; i++) {
Cartesian3.clone(positions[i], currentPos);
// Find the furthest point from the naive center to calculate the naive radius.
var r = Cartesian3.magnitude(Cartesian3.subtract(currentPos, naiveCenter, fromPointsScratch));
if (r > naiveRadius) {
naiveRadius = r;
}
// Make adjustments to the Ritter Sphere to include all points.
var oldCenterToPointSquared = Cartesian3.magnitudeSquared(Cartesian3.subtract(currentPos, ritterCenter, fromPointsScratch));
if (oldCenterToPointSquared > radiusSquared) {
var oldCenterToPoint = Math.sqrt(oldCenterToPointSquared);
// Calculate new radius to include the point that lies outside
ritterRadius = (ritterRadius + oldCenterToPoint) * 0.5;
radiusSquared = ritterRadius * ritterRadius;
// Calculate center of new Ritter sphere
var oldToNew = oldCenterToPoint - ritterRadius;
ritterCenter.x = (ritterRadius * ritterCenter.x + oldToNew * currentPos.x) / oldCenterToPoint;
ritterCenter.y = (ritterRadius * ritterCenter.y + oldToNew * currentPos.y) / oldCenterToPoint;
ritterCenter.z = (ritterRadius * ritterCenter.z + oldToNew * currentPos.z) / oldCenterToPoint;
}
}
if (ritterRadius < naiveRadius) {
Cartesian3.clone(ritterCenter, result.center);
result.radius = ritterRadius;
} else {
Cartesian3.clone(naiveCenter, result.center);
result.radius = naiveRadius;
}
return result;
};
var defaultProjection = new GeographicProjection();
var fromExtent2DLowerLeft = new Cartesian3();
var fromExtent2DUpperRight = new Cartesian3();
var fromExtent2DSouthwest = new Cartographic();
var fromExtent2DNortheast = new Cartographic();
/**
* Computes a bounding sphere from an extent projected in 2D.
*
* @memberof BoundingSphere
*
* @param {Extent} extent The extent around which to create a bounding sphere.
* @param {Object} [projection=GeographicProjection] The projection used to project the extent into 2D.
* @param {BoundingSphere} [result] The object onto which to store the result.
* @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if none was provided.
*/
BoundingSphere.fromExtent2D = function(extent, projection, result) {
return BoundingSphere.fromExtentWithHeights2D(extent, projection, 0.0, 0.0, result);
};
/**
* Computes a bounding sphere from an extent projected in 2D. The bounding sphere accounts for the
* object's minimum and maximum heights over the extent.
*
* @memberof BoundingSphere
*
* @param {Extent} extent The extent around which to create a bounding sphere.
* @param {Object} [projection=GeographicProjection] The projection used to project the extent into 2D.
* @param {Number} [minimumHeight=0.0] The minimum height over the extent.
* @param {Number} [maximumHeight=0.0] The maximum height over the extent.
* @param {BoundingSphere} [result] The object onto which to store the result.
* @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if none was provided.
*/
BoundingSphere.fromExtentWithHeights2D = function(extent, projection, minimumHeight, maximumHeight, result) {
if (!defined(result)) {
result = new BoundingSphere();
}
if (!defined(extent)) {
result.center = Cartesian3.clone(Cartesian3.ZERO, result.center);
result.radius = 0.0;
return result;
}
projection = defaultValue(projection, defaultProjection);
extent.getSouthwest(fromExtent2DSouthwest);
fromExtent2DSouthwest.height = minimumHeight;
extent.getNortheast(fromExtent2DNortheast);
fromExtent2DNortheast.height = maximumHeight;
var lowerLeft = projection.project(fromExtent2DSouthwest, fromExtent2DLowerLeft);
var upperRight = projection.project(fromExtent2DNortheast, fromExtent2DUpperRight);
var width = upperRight.x - lowerLeft.x;
var height = upperRight.y - lowerLeft.y;
var elevation = upperRight.z - lowerLeft.z;
result.radius = Math.sqrt(width * width + height * height + elevation * elevation) * 0.5;
var center = result.center;
center.x = lowerLeft.x + width * 0.5;
center.y = lowerLeft.y + height * 0.5;
center.z = lowerLeft.z + elevation * 0.5;
return result;
};
var fromExtent3DScratch = [];
/**
* Computes a bounding sphere from an extent in 3D. The bounding sphere is created using a subsample of points
* on the ellipsoid and contained in the extent. It may not be accurate for all extents on all types of ellipsoids.
* @memberof BoundingSphere
*
* @param {Extent} extent The valid extent used to create a bounding sphere.
* @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid used to determine positions of the extent.
* @param {Number} [surfaceHeight=0.0] The height above the surface of the ellipsoid.
* @param {BoundingSphere} [result] The object onto which to store the result.
* @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if none was provided.
*/
BoundingSphere.fromExtent3D = function(extent, ellipsoid, surfaceHeight, result) {
ellipsoid = defaultValue(ellipsoid, Ellipsoid.WGS84);
surfaceHeight = defaultValue(surfaceHeight, 0.0);
var positions;
if (defined(extent)) {
positions = extent.subsample(ellipsoid, surfaceHeight, fromExtent3DScratch);
}
return BoundingSphere.fromPoints(positions, result);
};
/**
* Computes a tight-fitting bounding sphere enclosing a list of 3D points, where the points are
* stored in a flat array in X, Y, Z, order. The bounding sphere is computed by running two
* algorithms, a naive algorithm and Ritter's algorithm. The smaller of the two spheres is used to
* ensure a tight fit.
*
* @memberof BoundingSphere
*
* @param {Array} positions An array of points that the bounding sphere will enclose. Each point
* is formed from three elements in the array in the order X, Y, Z.
* @param {Cartesian3} [center=Cartesian3.ZERO] The position to which the positions are relative, which need not be the
* origin of the coordinate system. This is useful when the positions are to be used for
* relative-to-center (RTC) rendering.
* @param {Number} [stride=3] The number of array elements per vertex. It must be at least 3, but it may
* be higher. Regardless of the value of this parameter, the X coordinate of the first position
* is at array index 0, the Y coordinate is at array index 1, and the Z coordinate is at array index
* 2. When stride is 3, the X coordinate of the next position then begins at array index 3. If
* the stride is 5, however, two array elements are skipped and the next position begins at array
* index 5.
* @param {BoundingSphere} [result] The object onto which to store the result.
* @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if one was not provided.
*
* @see <a href='http://blogs.agi.com/insight3d/index.php/2008/02/04/a-bounding/'>Bounding Sphere computation article</a>
*
* @example
* // Compute the bounding sphere from 3 positions, each specified relative to a center.
* // In addition to the X, Y, and Z coordinates, the points array contains two additional
* // elements per point which are ignored for the purpose of computing the bounding sphere.
* var center = new Cartesian3(1.0, 2.0, 3.0);
* var points = [1.0, 2.0, 3.0, 0.1, 0.2,
* 4.0, 5.0, 6.0, 0.1, 0.2,
* 7.0, 8.0, 9.0, 0.1, 0.2];
* var sphere = BoundingSphere.fromVertices(points, center, 5);
*/
BoundingSphere.fromVertices = function(positions, center, stride, result) {
if (!defined(result)) {
result = new BoundingSphere();
}
if (!defined(positions) || positions.length === 0) {
result.center = Cartesian3.clone(Cartesian3.ZERO, result.center);
result.radius = 0.0;
return result;
}
center = defaultValue(center, Cartesian3.ZERO);
stride = defaultValue(stride, 3);
if (stride < 3) {
throw new DeveloperError('stride must be 3 or greater.');
}
var currentPos = fromPointsCurrentPos;
currentPos.x = positions[0] + center.x;
currentPos.y = positions[1] + center.y;
currentPos.z = positions[2] + center.z;
var xMin = Cartesian3.clone(currentPos, fromPointsXMin);
var yMin = Cartesian3.clone(currentPos, fromPointsYMin);
var zMin = Cartesian3.clone(currentPos, fromPointsZMin);
var xMax = Cartesian3.clone(currentPos, fromPointsXMax);
var yMax = Cartesian3.clone(currentPos, fromPointsYMax);
var zMax = Cartesian3.clone(currentPos, fromPointsZMax);
var numElements = positions.length;
for (var i = 0; i < numElements; i += stride) {
var x = positions[i] + center.x;
var y = positions[i + 1] + center.y;
var z = positions[i + 2] + center.z;
currentPos.x = x;
currentPos.y = y;
currentPos.z = z;
// Store points containing the the smallest and largest components
if (x < xMin.x) {
Cartesian3.clone(currentPos, xMin);
}
if (x > xMax.x) {
Cartesian3.clone(currentPos, xMax);
}
if (y < yMin.y) {
Cartesian3.clone(currentPos, yMin);
}
if (y > yMax.y) {
Cartesian3.clone(currentPos, yMax);
}
if (z < zMin.z) {
Cartesian3.clone(currentPos, zMin);
}
if (z > zMax.z) {
Cartesian3.clone(currentPos, zMax);
}
}
// Compute x-, y-, and z-spans (Squared distances b/n each component's min. and max.).
var xSpan = Cartesian3.magnitudeSquared(Cartesian3.subtract(xMax, xMin, fromPointsScratch));
var ySpan = Cartesian3.magnitudeSquared(Cartesian3.subtract(yMax, yMin, fromPointsScratch));
var zSpan = Cartesian3.magnitudeSquared(Cartesian3.subtract(zMax, zMin, fromPointsScratch));
// Set the diameter endpoints to the largest span.
var diameter1 = xMin;
var diameter2 = xMax;
var maxSpan = xSpan;
if (ySpan > maxSpan) {
maxSpan = ySpan;
diameter1 = yMin;
diameter2 = yMax;
}
if (zSpan > maxSpan) {
maxSpan = zSpan;
diameter1 = zMin;
diameter2 = zMax;
}
// Calculate the center of the initial sphere found by Ritter's algorithm
var ritterCenter = fromPointsRitterCenter;
ritterCenter.x = (diameter1.x + diameter2.x) * 0.5;
ritterCenter.y = (diameter1.y + diameter2.y) * 0.5;
ritterCenter.z = (diameter1.z + diameter2.z) * 0.5;
// Calculate the radius of the initial sphere found by Ritter's algorithm
var radiusSquared = Cartesian3.magnitudeSquared(Cartesian3.subtract(diameter2, ritterCenter, fromPointsScratch));
var ritterRadius = Math.sqrt(radiusSquared);
// Find the center of the sphere found using the Naive method.
var minBoxPt = fromPointsMinBoxPt;
minBoxPt.x = xMin.x;
minBoxPt.y = yMin.y;
minBoxPt.z = zMin.z;
var maxBoxPt = fromPointsMaxBoxPt;
maxBoxPt.x = xMax.x;
maxBoxPt.y = yMax.y;
maxBoxPt.z = zMax.z;
var naiveCenter = Cartesian3.multiplyByScalar(Cartesian3.add(minBoxPt, maxBoxPt, fromPointsScratch), 0.5, fromPointsNaiveCenterScratch);
// Begin 2nd pass to find naive radius and modify the ritter sphere.
var naiveRadius = 0;
for (i = 0; i < numElements; i += stride) {
currentPos.x = positions[i] + center.x;
currentPos.y = positions[i + 1] + center.y;
currentPos.z = positions[i + 2] + center.z;
// Find the furthest point from the naive center to calculate the naive radius.
var r = Cartesian3.magnitude(Cartesian3.subtract(currentPos, naiveCenter, fromPointsScratch));
if (r > naiveRadius) {
naiveRadius = r;
}
// Make adjustments to the Ritter Sphere to include all points.
var oldCenterToPointSquared = Cartesian3.magnitudeSquared(Cartesian3.subtract(currentPos, ritterCenter, fromPointsScratch));
if (oldCenterToPointSquared > radiusSquared) {
var oldCenterToPoint = Math.sqrt(oldCenterToPointSquared);
// Calculate new radius to include the point that lies outside
ritterRadius = (ritterRadius + oldCenterToPoint) * 0.5;
radiusSquared = ritterRadius * ritterRadius;
// Calculate center of new Ritter sphere
var oldToNew = oldCenterToPoint - ritterRadius;
ritterCenter.x = (ritterRadius * ritterCenter.x + oldToNew * currentPos.x) / oldCenterToPoint;
ritterCenter.y = (ritterRadius * ritterCenter.y + oldToNew * currentPos.y) / oldCenterToPoint;
ritterCenter.z = (ritterRadius * ritterCenter.z + oldToNew * currentPos.z) / oldCenterToPoint;
}
}
if (ritterRadius < naiveRadius) {
Cartesian3.clone(ritterCenter, result.center);
result.radius = ritterRadius;
} else {
Cartesian3.clone(naiveCenter, result.center);
result.radius = naiveRadius;
}
return result;
};
/**
* Computes a bounding sphere from the corner points of an axis-aligned bounding box. The sphere
* tighly and fully encompases the box.
*
* @memberof BoundingSphere
*
* @param {Number} [corner] The minimum height over the extent.
* @param {Number} [oppositeCorner] The maximum height over the extent.
* @param {BoundingSphere} [result] The object onto which to store the result.
*
* @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if none was provided.
*
* @exception {DeveloperError} corner and oppositeCorner are required.
*
* @example
* // Create a bounding sphere around the unit cube
* var sphere = BoundingSphere.fromCornerPoints(new Cartesian3(-0.5, -0.5, -0.5), new Cartesian3(0.5, 0.5, 0.5));
*/
BoundingSphere.fromCornerPoints = function(corner, oppositeCorner, result) {
if (!defined(corner) || !defined(oppositeCorner)) {
throw new DeveloperError('corner and oppositeCorner are required.');
}
if (!defined(result)) {
result = new BoundingSphere();
}
var center = result.center;
Cartesian3.add(corner, oppositeCorner, center);
Cartesian3.multiplyByScalar(center, 0.5, center);
result.radius = Cartesian3.distance(center, oppositeCorner);
return result;
};
/**
* Creates a bounding sphere encompassing an ellipsoid.
*
* @memberof BoundingSphere
*
* @param {Ellipsoid} ellipsoid The ellipsoid around which to create a bounding sphere.
* @param {BoundingSphere} [result] The object onto which to store the result.
*
* @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if none was provided.
*
* @exception {DeveloperError} ellipsoid is required.
*
* @example
* var boundingSphere = BoundingSphere.fromEllipsoid(ellipsoid);
*/
BoundingSphere.fromEllipsoid = function(ellipsoid, result) {
if (!defined(ellipsoid)) {
throw new DeveloperError('ellipsoid is required.');
}
if (!defined(result)) {
result = new BoundingSphere();
}
Cartesian3.clone(Cartesian3.ZERO, result.center);
result.radius = ellipsoid.getMaximumRadius();
return result;
};
/**
* Duplicates a BoundingSphere instance.
* @memberof BoundingSphere
*
* @param {BoundingSphere} sphere The bounding sphere to duplicate.
* @param {BoundingSphere} [result] The object onto which to store the result.
* @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if none was provided. (Returns undefined if sphere is undefined)
*/
BoundingSphere.clone = function(sphere, result) {
if (!defined(sphere)) {
return undefined;
}
if (!defined(result)) {
return new BoundingSphere(sphere.center, sphere.radius);
}
result.center = Cartesian3.clone(sphere.center, result.center);
result.radius = sphere.radius;
return result;
};
var unionScratch = new Cartesian3();
var unionScratchCenter = new Cartesian3();
/**
* Computes a bounding sphere that contains both the left and right bounding spheres.
* @memberof BoundingSphere
*
* @param {BoundingSphere} left A sphere to enclose in a bounding sphere.
* @param {BoundingSphere} right A sphere to enclose in a bounding sphere.
* @param {BoundingSphere} [result] The object onto which to store the result.
* @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if none was provided.
*
* @exception {DeveloperError} left is required.
* @exception {DeveloperError} right is required.
*/
BoundingSphere.union = function(left, right, result) {
if (!defined(left)) {
throw new DeveloperError('left is required.');
}
if (!defined(right)) {
throw new DeveloperError('right is required.');
}
if (!defined(result)) {
result = new BoundingSphere();
}
var leftCenter = left.center;
var rightCenter = right.center;
Cartesian3.add(leftCenter, rightCenter, unionScratchCenter);
var center = Cartesian3.multiplyByScalar(unionScratchCenter, 0.5, unionScratchCenter);
var radius1 = Cartesian3.magnitude(Cartesian3.subtract(leftCenter, center, unionScratch)) + left.radius;
var radius2 = Cartesian3.magnitude(Cartesian3.subtract(rightCenter, center, unionScratch)) + right.radius;
result.radius = Math.max(radius1, radius2);
Cartesian3.clone(center, result.center);
return result;
};
var expandScratch = new Cartesian3();
/**
* Computes a bounding sphere by enlarging the provided sphere to contain the provided point.
* @memberof BoundingSphere
*
* @param {BoundingSphere} sphere A sphere to expand.
* @param {Cartesian3} point A point to enclose in a bounding sphere.
* @param {BoundingSphere} [result] The object onto which to store the result.
* @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if none was provided.
*
* @exception {DeveloperError} sphere is required.
* @exception {DeveloperError} point is required.
*/
BoundingSphere.expand = function(sphere, point, result) {
if (!defined(sphere)) {
throw new DeveloperError('sphere is required.');
}
if (!defined(point)) {
throw new DeveloperError('point is required.');
}
result = BoundingSphere.clone(sphere, result);
var radius = Cartesian3.magnitude(Cartesian3.subtract(point, result.center, expandScratch));
if (radius > result.radius) {
result.radius = radius;
}
return result;
};
/**
* Determines which side of a plane a sphere is located.
* @memberof BoundingSphere
*
* @param {BoundingSphere} sphere The bounding sphere to test.
* @param {Cartesian4} plane The coefficients of the plane in the for ax + by + cz + d = 0
* where the coefficients a, b, c, and d are the components x, y, z,
* and w of the {Cartesian4}, respectively.
* @returns {Intersect} {Intersect.INSIDE} if the entire sphere is on the side of the plane the normal
* is pointing, {Intersect.OUTSIDE} if the entire sphere is on the opposite side,
* and {Intersect.INTERSETING} if the sphere intersects the plane.
*
* @exception {DeveloperError} sphere is required.
* @exception {DeveloperError} plane is required.
*/
BoundingSphere.intersect = function(sphere, plane) {
if (!defined(sphere)) {
throw new DeveloperError('sphere is required.');
}
if (!defined(plane)) {
throw new DeveloperError('plane is required.');
}
var center = sphere.center;
var radius = sphere.radius;
var distanceToPlane = Cartesian3.dot(plane, center) + plane.w;
if (distanceToPlane < -radius) {
// The center point is negative side of the plane normal
return Intersect.OUTSIDE;
} else if (distanceToPlane < radius) {
// The center point is positive side of the plane, but radius extends beyond it; partial overlap
return Intersect.INTERSECTING;
}
return Intersect.INSIDE;
};
var transformCart4 = Cartesian4.clone(Cartesian4.UNIT_W);
/**
* Applies a 4x4 affine transformation matrix to a bounding sphere.
* @memberof BoundingSphere
*
* @param {BoundingSphere} sphere The bounding sphere to apply the transformation to.
* @param {Matrix4} transform The transformation matrix to apply to the bounding sphere.
* @param {BoundingSphere} [result] The object onto which to store the result.
* @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if none was provided.
*
* @exception {DeveloperError} sphere is required.
* @exception {DeveloperError} transform is required.
*/
BoundingSphere.transform = function(sphere, transform, result) {
if (!defined(sphere)) {
throw new DeveloperError('sphere is required.');
}
if (!defined(transform)) {
throw new DeveloperError('transform is required.');
}
if (!defined(result)) {
result = new BoundingSphere();
}
Matrix4.multiplyByPoint(transform, sphere.center, transformCart4);
Cartesian3.clone(transformCart4, result.center);
result.radius = sphere.radius;
return result;
};
var scratchCartesian3 = new Cartesian3();
/**
* The distances calculated by the vector from the center of the bounding sphere to position projected onto direction
* plus/minus the radius of the bounding sphere.
* <br>
* If you imagine the infinite number of planes with normal direction, this computes the smallest distance to the
* closest and farthest planes from position that intersect the bounding sphere.
* @memberof BoundingSphere
*
* @param {BoundingSphere} sphere The bounding sphere to calculate the distance to.
* @param {Cartesian3} position The position to calculate the distance from.
* @param {Cartesian3} direction The direction from position.
* @param {Cartesian2} [result] A Cartesian2 to store the nearest and farthest distances.
* @returns {Interval} The nearest and farthest distances on the bounding sphere from position in direction.
*
* @exception {DeveloperError} sphere is required.
* @exception {DeveloperError} position is required.
* @exception {DeveloperError} direction is required.
*/
BoundingSphere.getPlaneDistances = function(sphere, position, direction, result) {
if (!defined(sphere)) {
throw new DeveloperError('sphere is required.');
}
if (!defined(position)) {
throw new DeveloperError('position is required.');
}
if (!defined(direction)) {
throw new DeveloperError('direction is required.');
}
if (!defined(result)) {
result = new Interval();
}
var toCenter = Cartesian3.subtract(sphere.center, position, scratchCartesian3);
var proj = Cartesian3.multiplyByScalar(direction, Cartesian3.dot(direction, toCenter), scratchCartesian3);
var mag = Cartesian3.magnitude(proj);
result.start = mag - sphere.radius;
result.stop = mag + sphere.radius;
return result;
};
var projectTo2DNormalScratch = new Cartesian3();
var projectTo2DEastScratch = new Cartesian3();
var projectTo2DNorthScratch = new Cartesian3();
var projectTo2DWestScratch = new Cartesian3();
var projectTo2DSouthScratch = new Cartesian3();
var projectTo2DCartographicScratch = new Cartographic();
var projectTo2DPositionsScratch = new Array(8);
for (var n = 0; n < 8; ++n) {
projectTo2DPositionsScratch[n] = new Cartesian3();
}
var projectTo2DProjection = new GeographicProjection();
/**
* Creates a bounding sphere in 2D from a bounding sphere in 3D world coordinates.
* @memberof BoundingSphere
*
* @param {BoundingSphere} sphere The bounding sphere to transform to 2D.
* @param {Object} [projection=GeographicProjection] The projection to 2D.
* @param {BoundingSphere} [result] The object onto which to store the result.
* @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if none was provided.
*
* @exception {DeveloperError} sphere is required.
*/
BoundingSphere.projectTo2D = function(sphere, projection, result) {
if (!defined(sphere)) {
throw new DeveloperError('sphere is required.');
}
projection = defaultValue(projection, projectTo2DProjection);
var ellipsoid = projection.getEllipsoid();
var center = sphere.center;
var radius = sphere.radius;
var normal = ellipsoid.geodeticSurfaceNormal(center, projectTo2DNormalScratch);
var east = Cartesian3.cross(Cartesian3.UNIT_Z, normal, projectTo2DEastScratch);
Cartesian3.normalize(east, east);
var north = Cartesian3.cross(normal, east, projectTo2DNorthScratch);
Cartesian3.normalize(north, north);
Cartesian3.multiplyByScalar(normal, radius, normal);
Cartesian3.multiplyByScalar(north, radius, north);
Cartesian3.multiplyByScalar(east, radius, east);
var south = Cartesian3.negate(north, projectTo2DSouthScratch);
var west = Cartesian3.negate(east, projectTo2DWestScratch);
var positions = projectTo2DPositionsScratch;
// top NE corner
var corner = positions[0];
Cartesian3.add(normal, north, corner);
Cartesian3.add(corner, east, corner);
// top NW corner
corner = positions[1];
Cartesian3.add(normal, north, corner);
Cartesian3.add(corner, west, corner);
// top SW corner
corner = positions[2];
Cartesian3.add(normal, south, corner);
Cartesian3.add(corner, west, corner);
// top SE corner
corner = positions[3];
Cartesian3.add(normal, south, corner);
Cartesian3.add(corner, east, corner);
Cartesian3.negate(normal, normal);
// bottom NE corner
corner = positions[4];
Cartesian3.add(normal, north, corner);
Cartesian3.add(corner, east, corner);
// bottom NW corner
corner = positions[5];
Cartesian3.add(normal, north, corner);
Cartesian3.add(corner, west, corner);
// bottom SW corner
corner = positions[6];
Cartesian3.add(normal, south, corner);
Cartesian3.add(corner, west, corner);
// bottom SE corner
corner = positions[7];
Cartesian3.add(normal, south, corner);
Cartesian3.add(corner, east, corner);
var length = positions.length;
for (var i = 0; i < length; ++i) {
var position = positions[i];
Cartesian3.add(center, position, position);
var cartographic = ellipsoid.cartesianToCartographic(position, projectTo2DCartographicScratch);
projection.project(cartographic, position);
}
result = BoundingSphere.fromPoints(positions, result);
// swizzle center components
center = result.center;
var x = center.x;
var y = center.y;
var z = center.z;
center.x = z;
center.y = x;
center.z = y;
return result;
};
/**
* Compares the provided BoundingSphere componentwise and returns
* <code>true</code> if they are equal, <code>false</code> otherwise.
* @memberof BoundingSphere
*
* @param {BoundingSphere} [left] The first BoundingSphere.
* @param {BoundingSphere} [right] The second BoundingSphere.
* @returns {Boolean} <code>true</code> if left and right are equal, <code>false</code> otherwise.
*/
BoundingSphere.equals = function(left, right) {
return (left === right) ||
((defined(left)) &&
(defined(right)) &&
Cartesian3.equals(left.center, right.center) &&
left.radius === right.radius);
};
/**
* Duplicates this BoundingSphere instance.
* @memberof BoundingSphere
*
* @param {BoundingSphere} [result] The object onto which to store the result.
* @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if none was provided.
*/
BoundingSphere.prototype.clone = function(result) {
return BoundingSphere.clone(this, result);
};
/**
* Computes a bounding sphere that contains both this bounding sphere and the argument sphere.
* @memberof BoundingSphere
*
* @param {BoundingSphere} right The sphere to enclose in this bounding sphere.
* @param {BoundingSphere} [result] The object onto which to store the result.
* @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if none was provided.
*
* @exception {DeveloperError} sphere is required.
*/
BoundingSphere.prototype.union = function(right, result) {
return BoundingSphere.union(this, right, result);
};
/**
* Computes a bounding sphere that is sphere expanded to contain point.
* @memberof BoundingSphere
*
* @param {Cartesian3} point A point to enclose in a bounding sphere.
* @param {BoundingSphere} [result] The object onto which to store the result.
* @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if one was not provided.
*
* @exception {DeveloperError} point is required.
*/
BoundingSphere.prototype.expand = function(point, result) {
return BoundingSphere.expand(this, point, result);
};
/**
* Determines which side of a plane the sphere is located.
* @memberof BoundingSphere
*
* @param {Cartesian4} plane The coefficients of the plane in the for ax + by + cz + d = 0
* where the coefficients a, b, c, and d are the components x, y, z,
* and w of the {Cartesian4}, respectively.
* @returns {Intersect} {Intersect.INSIDE} if the entire sphere is on the side of the plane the normal
* is pointing, {Intersect.OUTSIDE} if the entire sphere is on the opposite side,
* and {Intersect.INTERSETING} if the sphere intersects the plane.
*
* @exception {DeveloperError} plane is required.
*/
BoundingSphere.prototype.intersect = function(plane) {
return BoundingSphere.intersect(this, plane);
};
/**
* Applies a 4x4 affine transformation matrix to this bounding sphere.
* @memberof BoundingSphere
*
* @param {Matrix4} transform The transformation matrix to apply to the bounding sphere.
* @param {BoundingSphere} [result] The object onto which to store the result.
* @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if none was provided.
*
* @exception {DeveloperError} transform is required.
*/
BoundingSphere.prototype.transform = function(transform, result) {
return BoundingSphere.transform(this, transform, result);
};
/**
* The distances calculated by the vector from the center of the bounding sphere to position projected onto direction
* plus/minus the radius of the bounding sphere.
* <br>
* If you imagine the infinite number of planes with normal direction, this computes the smallest distance to the
* closest and farthest planes from position that intersect the bounding sphere.
* @memberof BoundingSphere
*
* @param {Cartesian3} position The position to calculate the distance from.
* @param {Cartesian3} direction The direction from position.
* @param {Cartesian2} [result] A Cartesian2 to store the nearest and farthest distances.
* @returns {Interval} The nearest and farthest distances on the bounding sphere from position in direction.
*
* @exception {DeveloperError} position is required.
* @exception {DeveloperError} direction is required.
*/
BoundingSphere.prototype.getPlaneDistances = function(position, direction, result) {
return BoundingSphere.getPlaneDistances(this, position, direction, result);
};
/**
* Creates a bounding sphere in 2D from this bounding sphere. This bounding sphere must be in 3D world coordinates.
* @memberof BoundingSphere
*
* @param {Object} [projection=GeographicProjection] The projection to 2D.
* @param {BoundingSphere} [result] The object onto which to store the result.
* @returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if none was provided.
*/
BoundingSphere.prototype.projectTo2D = function(projection, result) {
return BoundingSphere.projectTo2D(this, projection, result);
};
/**
* Compares this BoundingSphere against the provided BoundingSphere componentwise and returns
* <code>true</code> if they are equal, <code>false</code> otherwise.
* @memberof BoundingSphere
*
* @param {BoundingSphere} [right] The right hand side BoundingSphere.
* @returns {Boolean} <code>true</code> if they are equal, <code>false</code> otherwise.
*/
BoundingSphere.prototype.equals = function(right) {
return BoundingSphere.equals(this, right);
};
return BoundingSphere;
});
/*global define*/
define('Core/GeometryAttribute',[
'./defaultValue',
'./defined',
'./DeveloperError'
], function(
defaultValue,
defined,
DeveloperError) {
"use strict";
/**
* Values and type information for geometry attributes. A {@link Geometry}
* generally contains one or more attributes. All attributes together form
* the geometry's vertices.
*
* @alias GeometryAttribute
* @constructor
*
* @param {ComponentDatatype} [options.componentDatatype=undefined] The datatype of each component in the attribute, e.g., individual elements in values.
* @param {Number} [options.componentsPerAttribute=undefined] A number between 1 and 4 that defines the number of components in an attributes.
* @param {Boolean} [options.normalize=false] When <code>true</code> and <code>componentDatatype</code> is an integer format, indicate that the components should be mapped to the range [0, 1] (unsigned) or [-1, 1] (signed) when they are accessed as floating-point for rendering.
* @param {Array} [options.values=undefined] The values for the attributes stored in a typed array.
*
* @exception {DeveloperError} options.componentDatatype is required.
* @exception {DeveloperError} options.componentsPerAttribute is required.
* @exception {DeveloperError} options.componentsPerAttribute must be between 1 and 4.
* @exception {DeveloperError} options.values is required.
*
* @example
* var geometry = new Geometry({
* attributes : {
* position : new GeometryAttribute({
* componentDatatype : ComponentDatatype.FLOAT,
* componentsPerAttribute : 3,
* values : [
* 0.0, 0.0, 0.0,
* 7500000.0, 0.0, 0.0,
* 0.0, 7500000.0, 0.0
* ]
* })
* },
* primitiveType : PrimitiveType.LINE_LOOP
* });
*
* @see Geometry
*/
var GeometryAttribute = function(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
if (!defined(options.componentDatatype)) {
throw new DeveloperError('options.componentDatatype is required.');
}
if (!defined(options.componentsPerAttribute)) {
throw new DeveloperError('options.componentsPerAttribute is required.');
}
if (options.componentsPerAttribute < 1 || options.componentsPerAttribute > 4) {
throw new DeveloperError('options.componentsPerAttribute must be between 1 and 4.');
}
if (!defined(options.values)) {
throw new DeveloperError('options.values is required.');
}
/**
* The datatype of each component in the attribute, e.g., individual elements in
* {@see GeometryAttribute#values}.
*
* @type ComponentDatatype
*
* @default undefined
*/
this.componentDatatype = options.componentDatatype;
/**
* A number between 1 and 4 that defines the number of components in an attributes.
* For example, a position attribute with x, y, and z components would have 3 as
* shown in the code example.
*
* @type Number
*
* @default undefined
*
* @example
* attribute.componentDatatype : ComponentDatatype.FLOAT,
* attribute.componentsPerAttribute : 3,
* attribute.values = new Float32Array([
* 0.0, 0.0, 0.0,
* 7500000.0, 0.0, 0.0,
* 0.0, 7500000.0, 0.0
* ]);
*/
this.componentsPerAttribute = options.componentsPerAttribute;
/**
* When <code>true</code> and <code>componentDatatype</code> is an integer format,
* indicate that the components should be mapped to the range [0, 1] (unsigned)
* or [-1, 1] (signed) when they are accessed as floating-point for rendering.
* <p>
* This is commonly used when storing colors using {@ ComponentDatatype.UNSIGNED_BYTE}.
* </p>
*
* @type Boolean
*
* @default false
*
* @example
* attribute.componentDatatype : ComponentDatatype.UNSIGNED_BYTE,
* attribute.componentsPerAttribute : 4,
* attribute.normalize = true;
* attribute.values = new Uint8Array([
* Color.floatToByte(color.red)
* Color.floatToByte(color.green)
* Color.floatToByte(color.blue)
* Color.floatToByte(color.alpha)
* ]);
*/
this.normalize = defaultValue(options.normalize, false);
/**
* The values for the attributes stored in a typed array. In the code example,
* every three elements in <code>values</code> defines one attributes since
* <code>componentsPerAttribute</code> is 3.
*
* @type Array
*
* @default undefined
*
* @example
* attribute.componentDatatype : ComponentDatatype.FLOAT,
* attribute.componentsPerAttribute : 3,
* attribute.values = new Float32Array([
* 0.0, 0.0, 0.0,
* 7500000.0, 0.0, 0.0,
* 0.0, 7500000.0, 0.0
* ]);
*/
this.values = options.values;
};
return GeometryAttribute;
});
/*global define*/
define('Core/GeometryAttributes',['./defaultValue'], function(defaultValue) {
"use strict";
/**
* Attributes, which make up a geometry's vertices. Each property in this object corresponds to a
* {@link GeometryAttribute} containing the attribute's data.
* <p>
* Attributes are always stored non-interleaved in a Geometry. When geometry is prepared for rendering
* with {@link Context#createVertexArrayFromGeometry}, attributes are generally written interleaved
* into the vertex buffer for better rendering performance.
* </p>
*
* @alias VertexFormat
* @constructor
*/
var GeometryAttributes = function(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
/**
* The 3D position attribute.
* <p>
* 64-bit floating-point (for precision). 3 components per attribute.
* </p>
*
* @type GeometryAttribute
*
* @default undefined
*/
this.position = options.position;
/**
* The normal attribute (normalized), which is commonly used for lighting.
* <p>
* 32-bit floating-point. 3 components per attribute.
* </p>
*
* @type GeometryAttribute
*
* @default undefined
*/
this.normal = options.normal;
/**
* The 2D texture coordinate attribute.
* <p>
* 32-bit floating-point. 2 components per attribute
* </p>
*
* @type GeometryAttribute
*
* @default undefined
*/
this.st = options.st;
/**
* The binormal attribute (normalized), which is used for tangent-space effects like bump mapping.
* <p>
* 32-bit floating-point. 3 components per attribute.
* </p>
*
* @type GeometryAttribute
*
* @default undefined
*/
this.binormal = options.binormal;
/**
* The tangent attribute (normalized), which is used for tangent-space effects like bump mapping.
* <p>
* 32-bit floating-point. 3 components per attribute.
* </p>
*
* @type GeometryAttribute
*
* @default undefined
*/
this.tangent = options.tangent;
/**
* The color attribute.
* <p>
* 8-bit unsigned integer. 4 components per attribute.
* </p>
*
* @type GeometryAttribute
*
* @default undefined
*/
this.color = options.color;
};
return GeometryAttributes;
});
/*global define*/
define('Core/VertexFormat',[
'./defaultValue',
'./freezeObject'
], function(
defaultValue,
freezeObject) {
"use strict";
/**
* A vertex format defines what attributes make up a vertex. A VertexFormat can be provided
* to a {@link Geometry} to request that certain properties be computed, e.g., just position,
* position and normal, etc.
*
* @param {Object} [options=undefined] An object with boolean properties corresponding to VertexFormat properties as shown in the code example.
*
* @alias VertexFormat
* @constructor
*
* @example
* // Create a vertex format with position and 2D texture coordinate attributes.
* var format = new VertexFormat({
* position : true,
* st : true
* });
*
* @see Geometry#attributes
*/
var VertexFormat = function(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
/**
* When <code>true</code>, the vertex has a 3D position attribute.
* <p>
* 64-bit floating-point (for precision). 3 components per attribute.
* </p>
*
* @type Boolean
*
* @default false
*/
this.position = defaultValue(options.position, false);
/**
* When <code>true</code>, the vertex has a normal attribute (normalized), which is commonly used for lighting.
* <p>
* 32-bit floating-point. 3 components per attribute.
* </p>
*
* @type Boolean
*
* @default false
*/
this.normal = defaultValue(options.normal, false);
/**
* When <code>true</code>, the vertex has a 2D texture coordinate attribute.
* <p>
* 32-bit floating-point. 2 components per attribute
* </p>
*
* @type Boolean
*
* @default false
*/
this.st = defaultValue(options.st, false);
/**
* When <code>true</code>, the vertex has a binormal attribute (normalized), which is used for tangent-space effects like bump mapping.
* <p>
* 32-bit floating-point. 3 components per attribute.
* </p>
*
* @type Boolean
*
* @default false
*/
this.binormal = defaultValue(options.binormal, false);
/**
* When <code>true</code>, the vertex has a tangent attribute (normalized), which is used for tangent-space effects like bump mapping.
* <p>
* 32-bit floating-point. 3 components per attribute.
* </p>
*
* @type Boolean
*
* @default false
*/
this.tangent = defaultValue(options.tangent, false);
};
/**
* An immutable vertex format with only a position attribute.
*
* @memberof VertexFormat
*
* @see VertexFormat#position
*/
VertexFormat.POSITION_ONLY = freezeObject(new VertexFormat({
position : true
}));
/**
* An immutable vertex format with position and normal attributes.
* This is compatible with per-instance color appearances like {@link PerInstanceColorAppearance}.
*
* @memberof VertexFormat
*
* @see VertexFormat#position
* @see VertexFormat#normal
*/
VertexFormat.POSITION_AND_NORMAL = freezeObject(new VertexFormat({
position : true,
normal : true
}));
/**
* An immutable vertex format with position, normal, and st attributes.
* This is compatible with {@link MaterialAppearance} when {@link MaterialAppearance#materialSupport}
* is <code>TEXTURED/code>.
*
* @memberof VertexFormat
*
* @see VertexFormat#position
* @see VertexFormat#normal
* @see VertexFormat#st
*/
VertexFormat.POSITION_NORMAL_AND_ST = freezeObject(new VertexFormat({
position : true,
normal : true,
st : true
}));
/**
* An immutable vertex format with position and st attributes.
* This is compatible with {@link EllipsoidSurfaceAppearance}.
*
* @memberof VertexFormat
*
* @see VertexFormat#position
* @see VertexFormat#st
*/
VertexFormat.POSITION_AND_ST = freezeObject(new VertexFormat({
position : true,
st : true
}));
/**
* An immutable vertex format with all well-known attributes: position, normal, st, binormal, and tangent.
*
* @memberof VertexFormat
*
* @see VertexFormat#position
* @see VertexFormat#normal
* @see VertexFormat#st
* @see VertexFormat#binormal
* @see VertexFormat#tangent
*/
VertexFormat.ALL = freezeObject(new VertexFormat({
position : true,
normal : true,
st : true,
binormal : true,
tangent : true
}));
/**
* An immutable vertex format with position, normal, and st attributes.
* This is compatible with most appearances and materials; however
* normal and st attributes are not always required. When this is
* known in advance, another <code>VertexFormat</code> should be used.
*
* @memberof VertexFormat
*
* @see VertexFormat#position
* @see VertexFormat#normal
*/
VertexFormat.DEFAULT = VertexFormat.POSITION_NORMAL_AND_ST;
return VertexFormat;
});
/*global define*/
define('Core/Geometry',[
'./defaultValue',
'./defined',
'./DeveloperError',
'./BoundingSphere'
], function(
defaultValue,
defined,
DeveloperError,
BoundingSphere) {
"use strict";
/**
* A geometry representation with attributes forming vertices and optional index data
* defining primitives. Geometries and an {@link Appearance}, which describes the shading,
* can be assigned to a {@link Primitive} for visualization. A <code>Primitive</code> can
* be created from many heterogeneous - in many cases - geometries for performance.
* <p>
* In low-level rendering code, a vertex array can be created from a geometry using
* {@link Context#createVertexArrayFromGeometry}.
* </p>
* <p>
* Geometries can be transformed and optimized using functions in {@link GeometryPipeline}.
* </p>
*
* @alias Geometry
* @constructor
*
* @param {GeometryAttributes} options.attributes Attributes, which make up the geometry's vertices.
* @param {PrimitiveType} options.primitiveType The type of primitives in the geometry.
* @param {Array} [options.indices] Optional index data that determines the primitives in the geometry.
* @param {BoundingSphere} [options.boundingSphere] An optional bounding sphere that fully enclosed the geometry.
* @exception {DeveloperError} options.attributes is required.
* @exception {DeveloperError} options.primitiveType is required.
*
* @example
* // Create geometry with a position attribute and indexed lines.
* var positions = new Float64Array([
* 0.0, 0.0, 0.0,
* 7500000.0, 0.0, 0.0,
* 0.0, 7500000.0, 0.0
* ]);
*
* var geometry = new Geometry({
* attributes : {
* position : new GeometryAttribute({
* componentDatatype : ComponentDatatype.DOUBLE,
* componentsPerAttribute : 3,
* values : positions
* })
* },
* indices : new Uint16Array([0, 1, 1, 2, 2, 0]),
* primitiveType : PrimitiveType.LINES,
* boundingSphere : BoundingSphere.fromVertices(positions)
* });
*
* @demo <a href="http://cesium.agi.com/Cesium/Apps/Sandcastle/index.html?src=Geometry%20and%20Appearances.html">Geometry and Appearances Demo</a>
*
* @see PolygonGeometry
* @see ExtentGeometry
* @see EllipseGeometry
* @see CircleGeometry
* @see WallGeometry
* @see SimplePolylineGeometry
* @see BoxGeometry
* @see EllipsoidGeometry
*/
var Geometry = function(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
if (!defined(options.attributes)) {
throw new DeveloperError('options.attributes is required.');
}
if (!defined(options.primitiveType)) {
throw new DeveloperError('options.primitiveType is required.');
}
/**
* Attributes, which make up the geometry's vertices. Each property in this object corresponds to a
* {@link GeometryAttribute} containing the attribute's data.
* <p>
* Attributes are always stored non-interleaved in a Geometry. When geometry is prepared for rendering
* with {@link Context#createVertexArrayFromGeometry}, attributes are generally written interleaved
* into the vertex buffer for better rendering performance.
* </p>
* <p>
* There are reserved attribute names with well-known semantics. The following attributes
* are created by a Geometry (depending on the provided {@link VertexFormat}.
* <ul>
* <li><code>position</code> - 3D vertex position. 64-bit floating-point (for precision). 3 components per attribute. See {@link VertexFormat#position}.</li>
* <li><code>normal</code> - Normal (normalized), commonly used for lighting. 32-bit floating-point. 3 components per attribute. See {@link VertexFormat#normal}.</li>
* <li><code>st</code> - 2D texture coordinate. 32-bit floating-point. 2 components per attribute. See {@link VertexFormat#st}.</li>
* <li><code>binormal</code> - Binormal (normalized), used for tangent-space effects like bump mapping. 32-bit floating-point. 3 components per attribute. See {@link VertexFormat#binormal}.</li>
* <li><code>tangent</code> - Tangent (normalized), used for tangent-space effects like bump mapping. 32-bit floating-point. 3 components per attribute. See {@link VertexFormat#tangent}.</li>
* </ul>
* </p>
* <p>
* The following attribute names are generally not created by a Geometry, but are added
* to a Geometry by a {@link Primitive} or {@link GeometryPipeline} functions to prepare
* the geometry for rendering.
* <ul>
* <li><code>position3DHigh</code> - High 32 bits for encoded 64-bit position computed with {@link GeometryPipeline.encodeAttribute}. 32-bit floating-point. 4 components per attribute.</li>
* <li><code>position3DLow</code> - Low 32 bits for encoded 64-bit position computed with {@link GeometryPipeline.encodeAttribute}. 32-bit floating-point. 4 components per attribute.</li>
* <li><code>position3DHigh</code> - High 32 bits for encoded 64-bit 2D (Columbus view) position computed with {@link GeometryPipeline.encodeAttribute}. 32-bit floating-point. 4 components per attribute.</li>
* <li><code>position2DLow</code> - Low 32 bits for encoded 64-bit 2D (Columbus view) position computed with {@link GeometryPipeline.encodeAttribute}. 32-bit floating-point. 4 components per attribute.</li>
* <li><code>color</code> - RGBA color (normalized) usually from {@link GeometryInstance#color}. 32-bit floating-point. 4 components per attribute.</li>
* <li><code>pickColor</code> - RGBA color used for picking, created from {@link Context#createPickId}. 32-bit floating-point. 4 components per attribute.</li>
* </ul>
* </p>
*
* @type GeometryAttributes
*
* @default undefined
*
* @example
* geometry.attributes.position = new GeometryAttribute({
* componentDatatype : ComponentDatatype.FLOAT,
* componentsPerAttribute : 3,
* values : new Float32Array()
* });
*
* @see GeometryAttribute
* @see VertexFormat
*/
this.attributes = options.attributes;
/**
* Optional index data that - along with {@link Geometry#primitiveType} -
* determines the primitives in the geometry.
*
* @type Array
*
* @default undefined
*/
this.indices = options.indices;
/**
* The type of primitives in the geometry. This is most often {@link PrimitiveType.TRIANGLES},
* but can varying based on the specific geometry.
*
* @type PrimitiveType
*
* @default undefined
*/
this.primitiveType = options.primitiveType;
/**
* An optional bounding sphere that fully encloses the geometry. This is
* commonly used for culling.
*
* @type BoundingSphere
*
* @default undefined
*/
this.boundingSphere = options.boundingSphere;
};
/**
* Computes the number of vertices in a geometry. The runtime is linear with
* respect to the number of attributes in a vertex, not the number of vertices.
*
* @memberof Geometry
*
* @param {Cartesian3} geometry The geometry.
*
* @returns {Number} The number of vertices in the geometry.
*
* @exception {DeveloperError} geometries is required.
*
* @example
* var numVertices = Geometry.computeNumberOfVertices(geometry);
*/
Geometry.computeNumberOfVertices = function(geometry) {
if (!defined(geometry)) {
throw new DeveloperError('geometry is required.');
}
var numberOfVertices = -1;
for ( var property in geometry.attributes) {
if (geometry.attributes.hasOwnProperty(property) &&
defined(geometry.attributes[property]) &&
defined(geometry.attributes[property].values)) {
var attribute = geometry.attributes[property];
var num = attribute.values.length / attribute.componentsPerAttribute;
if ((numberOfVertices !== num) && (numberOfVertices !== -1)) {
throw new DeveloperError('All attribute lists must have the same number of attributes.');
}
numberOfVertices = num;
}
}
return numberOfVertices;
};
return Geometry;
});
/*global define*/
define('Core/BoxGeometry',[
'./defined',
'./DeveloperError',
'./Cartesian3',
'./ComponentDatatype',
'./PrimitiveType',
'./defaultValue',
'./BoundingSphere',
'./GeometryAttribute',
'./GeometryAttributes',
'./VertexFormat',
'./Geometry'
], function(
defined,
DeveloperError,
Cartesian3,
ComponentDatatype,
PrimitiveType,
defaultValue,
BoundingSphere,
GeometryAttribute,
GeometryAttributes,
VertexFormat,
Geometry) {
"use strict";
var diffScratch = new Cartesian3();
/**
* Describes a cube centered at the origin.
*
* @alias BoxGeometry
* @constructor
*
* @param {Cartesian3} options.minimumCorner The minimum x, y, and z coordinates of the box.
* @param {Cartesian3} options.maximumCorner The maximum x, y, and z coordinates of the box.
* @param {VertexFormat} [options.vertexFormat=VertexFormat.DEFAULT] The vertex attributes to be computed.
*
* @exception {DeveloperError} options.minimumCorner is required.
* @exception {DeveloperError} options.maximumCorner is required.
*
* @see BoxGeometry#fromDimensions
* @see BoxGeometry#createGeometry
*
* @example
* var box = new BoxGeometry({
* vertexFormat : VertexFormat.POSITION_ONLY,
* maximumCorner : new Cartesian3(250000.0, 250000.0, 250000.0),
* minimumCorner : new Cartesian3(-250000.0, -250000.0, -250000.0)
* });
* var geometry = BoxGeometry.createGeometry(box);
*/
var BoxGeometry = function(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
var min = options.minimumCorner;
var max = options.maximumCorner;
if (!defined(min)) {
throw new DeveloperError('options.minimumCorner is required.');
}
if (!defined(max)) {
throw new DeveloperError('options.maximumCorner is required');
}
var vertexFormat = defaultValue(options.vertexFormat, VertexFormat.DEFAULT);
this._minimumCorner = Cartesian3.clone(min);
this._maximumCorner = Cartesian3.clone(max);
this._vertexFormat = vertexFormat;
this._workerName = 'createBoxGeometry';
};
/**
* Creates a cube centered at the origin given its dimensions.
* @memberof BoxGeometry
*
* @param {Cartesian3} options.dimensions The width, depth, and height of the box stored in the x, y, and z coordinates of the <code>Cartesian3</code>, respectively.
* @param {VertexFormat} [options.vertexFormat=VertexFormat.DEFAULT] The vertex attributes to be computed.
*
* @exception {DeveloperError} options.dimensions is required.
* @exception {DeveloperError} All dimensions components must be greater than or equal to zero.
*
* @see BoxGeometry#createGeometry
*
* @example
* var box = BoxGeometry.fromDimensions({
* vertexFormat : VertexFormat.POSITION_ONLY,
* dimensions : new Cartesian3(500000.0, 500000.0, 500000.0)
* });
* var geometry = BoxGeometry.createGeometry(box);
*/
BoxGeometry.fromDimensions = function(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
var dimensions = options.dimensions;
if (!defined(dimensions)) {
throw new DeveloperError('options.dimensions is required.');
}
if (dimensions.x < 0 || dimensions.y < 0 || dimensions.z < 0) {
throw new DeveloperError('All dimensions components must be greater than or equal to zero.');
}
var corner = Cartesian3.multiplyByScalar(dimensions, 0.5);
var min = Cartesian3.negate(corner);
var max = corner;
var newOptions = {
minimumCorner : min,
maximumCorner : max,
vertexFormat : options.vertexFormat
};
return new BoxGeometry(newOptions);
};
/**
* Computes the geometric representation of a box, including its vertices, indices, and a bounding sphere.
* @memberof BoxGeometry
*
* @param {BoxGeometry} boxGeometry A description of the box.
* @returns {Geometry} The computed vertices and indices.
*/
BoxGeometry.createGeometry = function(boxGeometry) {
var min = boxGeometry._minimumCorner;
var max = boxGeometry._maximumCorner;
var vertexFormat = boxGeometry._vertexFormat;
var attributes = new GeometryAttributes();
var indices;
var positions;
if (vertexFormat.position &&
(vertexFormat.st || vertexFormat.normal || vertexFormat.binormal || vertexFormat.tangent)) {
if (vertexFormat.position) {
// 8 corner points. Duplicated 3 times each for each incident edge/face.
positions = new Float64Array(6 * 4 * 3);
// +z face
positions[0] = min.x;
positions[1] = min.y;
positions[2] = max.z;
positions[3] = max.x;
positions[4] = min.y;
positions[5] = max.z;
positions[6] = max.x;
positions[7] = max.y;
positions[8] = max.z;
positions[9] = min.x;
positions[10] = max.y;
positions[11] = max.z;
// -z face
positions[12] = min.x;
positions[13] = min.y;
positions[14] = min.z;
positions[15] = max.x;
positions[16] = min.y;
positions[17] = min.z;
positions[18] = max.x;
positions[19] = max.y;
positions[20] = min.z;
positions[21] = min.x;
positions[22] = max.y;
positions[23] = min.z;
// +x face
positions[24] = max.x;
positions[25] = min.y;
positions[26] = min.z;
positions[27] = max.x;
positions[28] = max.y;
positions[29] = min.z;
positions[30] = max.x;
positions[31] = max.y;
positions[32] = max.z;
positions[33] = max.x;
positions[34] = min.y;
positions[35] = max.z;
// -x face
positions[36] = min.x;
positions[37] = min.y;
positions[38] = min.z;
positions[39] = min.x;
positions[40] = max.y;
positions[41] = min.z;
positions[42] = min.x;
positions[43] = max.y;
positions[44] = max.z;
positions[45] = min.x;
positions[46] = min.y;
positions[47] = max.z;
// +y face
positions[48] = min.x;
positions[49] = max.y;
positions[50] = min.z;
positions[51] = max.x;
positions[52] = max.y;
positions[53] = min.z;
positions[54] = max.x;
positions[55] = max.y;
positions[56] = max.z;
positions[57] = min.x;
positions[58] = max.y;
positions[59] = max.z;
// -y face
positions[60] = min.x;
positions[61] = min.y;
positions[62] = min.z;
positions[63] = max.x;
positions[64] = min.y;
positions[65] = min.z;
positions[66] = max.x;
positions[67] = min.y;
positions[68] = max.z;
positions[69] = min.x;
positions[70] = min.y;
positions[71] = max.z;
attributes.position = new GeometryAttribute({
componentDatatype : ComponentDatatype.DOUBLE,
componentsPerAttribute : 3,
values : positions
});
}
if (vertexFormat.normal) {
var normals = new Float32Array(6 * 4 * 3);
// +z face
normals[0] = 0.0;
normals[1] = 0.0;
normals[2] = 1.0;
normals[3] = 0.0;
normals[4] = 0.0;
normals[5] = 1.0;
normals[6] = 0.0;
normals[7] = 0.0;
normals[8] = 1.0;
normals[9] = 0.0;
normals[10] = 0.0;
normals[11] = 1.0;
// -z face
normals[12] = 0.0;
normals[13] = 0.0;
normals[14] = -1.0;
normals[15] = 0.0;
normals[16] = 0.0;
normals[17] = -1.0;
normals[18] = 0.0;
normals[19] = 0.0;
normals[20] = -1.0;
normals[21] = 0.0;
normals[22] = 0.0;
normals[23] = -1.0;
// +x face
normals[24] = 1.0;
normals[25] = 0.0;
normals[26] = 0.0;
normals[27] = 1.0;
normals[28] = 0.0;
normals[29] = 0.0;
normals[30] = 1.0;
normals[31] = 0.0;
normals[32] = 0.0;
normals[33] = 1.0;
normals[34] = 0.0;
normals[35] = 0.0;
// -x face
normals[36] = -1.0;
normals[37] = 0.0;
normals[38] = 0.0;
normals[39] = -1.0;
normals[40] = 0.0;
normals[41] = 0.0;
normals[42] = -1.0;
normals[43] = 0.0;
normals[44] = 0.0;
normals[45] = -1.0;
normals[46] = 0.0;
normals[47] = 0.0;
// +y face
normals[48] = 0.0;
normals[49] = 1.0;
normals[50] = 0.0;
normals[51] = 0.0;
normals[52] = 1.0;
normals[53] = 0.0;
normals[54] = 0.0;
normals[55] = 1.0;
normals[56] = 0.0;
normals[57] = 0.0;
normals[58] = 1.0;
normals[59] = 0.0;
// -y face
normals[60] = 0.0;
normals[61] = -1.0;
normals[62] = 0.0;
normals[63] = 0.0;
normals[64] = -1.0;
normals[65] = 0.0;
normals[66] = 0.0;
normals[67] = -1.0;
normals[68] = 0.0;
normals[69] = 0.0;
normals[70] = -1.0;
normals[71] = 0.0;
attributes.normal = new GeometryAttribute({
componentDatatype : ComponentDatatype.FLOAT,
componentsPerAttribute : 3,
values : normals
});
}
if (vertexFormat.st) {
var texCoords = new Float32Array(6 * 4 * 2);
// +z face
texCoords[0] = 0.0;
texCoords[1] = 0.0;
texCoords[2] = 1.0;
texCoords[3] = 0.0;
texCoords[4] = 1.0;
texCoords[5] = 1.0;
texCoords[6] = 0.0;
texCoords[7] = 1.0;
// -z face
texCoords[8] = 1.0;
texCoords[9] = 0.0;
texCoords[10] = 0.0;
texCoords[11] = 0.0;
texCoords[12] = 0.0;
texCoords[13] = 1.0;
texCoords[14] = 1.0;
texCoords[15] = 1.0;
//+x face
texCoords[16] = 0.0;
texCoords[17] = 0.0;
texCoords[18] = 1.0;
texCoords[19] = 0.0;
texCoords[20] = 1.0;
texCoords[21] = 1.0;
texCoords[22] = 0.0;
texCoords[23] = 1.0;
// -x face
texCoords[24] = 1.0;
texCoords[25] = 0.0;
texCoords[26] = 0.0;
texCoords[27] = 0.0;
texCoords[28] = 0.0;
texCoords[29] = 1.0;
texCoords[30] = 1.0;
texCoords[31] = 1.0;
// +y face
texCoords[32] = 1.0;
texCoords[33] = 0.0;
texCoords[34] = 0.0;
texCoords[35] = 0.0;
texCoords[36] = 0.0;
texCoords[37] = 1.0;
texCoords[38] = 1.0;
texCoords[39] = 1.0;
// -y face
texCoords[40] = 0.0;
texCoords[41] = 0.0;
texCoords[42] = 1.0;
texCoords[43] = 0.0;
texCoords[44] = 1.0;
texCoords[45] = 1.0;
texCoords[46] = 0.0;
texCoords[47] = 1.0;
attributes.st = new GeometryAttribute({
componentDatatype : ComponentDatatype.FLOAT,
componentsPerAttribute : 2,
values : texCoords
});
}
if (vertexFormat.tangent) {
var tangents = new Float32Array(6 * 4 * 3);
// +z face
tangents[0] = 1.0;
tangents[1] = 0.0;
tangents[2] = 0.0;
tangents[3] = 1.0;
tangents[4] = 0.0;
tangents[5] = 0.0;
tangents[6] = 1.0;
tangents[7] = 0.0;
tangents[8] = 0.0;
tangents[9] = 1.0;
tangents[10] = 0.0;
tangents[11] = 0.0;
// -z face
tangents[12] = -1.0;
tangents[13] = 0.0;
tangents[14] = 0.0;
tangents[15] = -1.0;
tangents[16] = 0.0;
tangents[17] = 0.0;
tangents[18] = -1.0;
tangents[19] = 0.0;
tangents[20] = 0.0;
tangents[21] = -1.0;
tangents[22] = 0.0;
tangents[23] = 0.0;
// +x face
tangents[24] = 0.0;
tangents[25] = 1.0;
tangents[26] = 0.0;
tangents[27] = 0.0;
tangents[28] = 1.0;
tangents[29] = 0.0;
tangents[30] = 0.0;
tangents[31] = 1.0;
tangents[32] = 0.0;
tangents[33] = 0.0;
tangents[34] = 1.0;
tangents[35] = 0.0;
// -x face
tangents[36] = 0.0;
tangents[37] = -1.0;
tangents[38] = 0.0;
tangents[39] = 0.0;
tangents[40] = -1.0;
tangents[41] = 0.0;
tangents[42] = 0.0;
tangents[43] = -1.0;
tangents[44] = 0.0;
tangents[45] = 0.0;
tangents[46] = -1.0;
tangents[47] = 0.0;
// +y face
tangents[48] = -1.0;
tangents[49] = 0.0;
tangents[50] = 0.0;
tangents[51] = -1.0;
tangents[52] = 0.0;
tangents[53] = 0.0;
tangents[54] = -1.0;
tangents[55] = 0.0;
tangents[56] = 0.0;
tangents[57] = -1.0;
tangents[58] = 0.0;
tangents[59] = 0.0;
// -y face
tangents[60] = 1.0;
tangents[61] = 0.0;
tangents[62] = 0.0;
tangents[63] = 1.0;
tangents[64] = 0.0;
tangents[65] = 0.0;
tangents[66] = 1.0;
tangents[67] = 0.0;
tangents[68] = 0.0;
tangents[69] = 1.0;
tangents[70] = 0.0;
tangents[71] = 0.0;
attributes.tangent = new GeometryAttribute({
componentDatatype : ComponentDatatype.FLOAT,
componentsPerAttribute : 3,
values : tangents
});
}
if (vertexFormat.binormal) {
var binormals = new Float32Array(6 * 4 * 3);
// +z face
binormals[0] = 0.0;
binormals[1] = 1.0;
binormals[2] = 0.0;
binormals[3] = 0.0;
binormals[4] = 1.0;
binormals[5] = 0.0;
binormals[6] = 0.0;
binormals[7] = 1.0;
binormals[8] = 0.0;
binormals[9] = 0.0;
binormals[10] = 1.0;
binormals[11] = 0.0;
// -z face
binormals[12] = 0.0;
binormals[13] = 1.0;
binormals[14] = 0.0;
binormals[15] = 0.0;
binormals[16] = 1.0;
binormals[17] = 0.0;
binormals[18] = 0.0;
binormals[19] = 1.0;
binormals[20] = 0.0;
binormals[21] = 0.0;
binormals[22] = 1.0;
binormals[23] = 0.0;
// +x face
binormals[24] = 0.0;
binormals[25] = 0.0;
binormals[26] = 1.0;
binormals[27] = 0.0;
binormals[28] = 0.0;
binormals[29] = 1.0;
binormals[30] = 0.0;
binormals[31] = 0.0;
binormals[32] = 1.0;
binormals[33] = 0.0;
binormals[34] = 0.0;
binormals[35] = 1.0;
// -x face
binormals[36] = 0.0;
binormals[37] = 0.0;
binormals[38] = 1.0;
binormals[39] = 0.0;
binormals[40] = 0.0;
binormals[41] = 1.0;
binormals[42] = 0.0;
binormals[43] = 0.0;
binormals[44] = 1.0;
binormals[45] = 0.0;
binormals[46] = 0.0;
binormals[47] = 1.0;
// +y face
binormals[48] = 0.0;
binormals[49] = 0.0;
binormals[50] = 1.0;
binormals[51] = 0.0;
binormals[52] = 0.0;
binormals[53] = 1.0;
binormals[54] = 0.0;
binormals[55] = 0.0;
binormals[56] = 1.0;
binormals[57] = 0.0;
binormals[58] = 0.0;
binormals[59] = 1.0;
// -y face
binormals[60] = 0.0;
binormals[61] = 0.0;
binormals[62] = 1.0;
binormals[63] = 0.0;
binormals[64] = 0.0;
binormals[65] = 1.0;
binormals[66] = 0.0;
binormals[67] = 0.0;
binormals[68] = 1.0;
binormals[69] = 0.0;
binormals[70] = 0.0;
binormals[71] = 1.0;
attributes.binormal = new GeometryAttribute({
componentDatatype : ComponentDatatype.FLOAT,
componentsPerAttribute : 3,
values : binormals
});
}
// 12 triangles: 6 faces, 2 triangles each.
indices = new Uint16Array(6 * 2 * 3);
// +z face
indices[0] = 0;
indices[1] = 1;
indices[2] = 2;
indices[3] = 0;
indices[4] = 2;
indices[5] = 3;
// -z face
indices[6] = 4 + 2;
indices[7] = 4 + 1;
indices[8] = 4 + 0;
indices[9] = 4 + 3;
indices[10] = 4 + 2;
indices[11] = 4 + 0;
// +x face
indices[12] = 8 + 0;
indices[13] = 8 + 1;
indices[14] = 8 + 2;
indices[15] = 8 + 0;
indices[16] = 8 + 2;
indices[17] = 8 + 3;
// -x face
indices[18] = 12 + 2;
indices[19] = 12 + 1;
indices[20] = 12 + 0;
indices[21] = 12 + 3;
indices[22] = 12 + 2;
indices[23] = 12 + 0;
// +y face
indices[24] = 16 + 2;
indices[25] = 16 + 1;
indices[26] = 16 + 0;
indices[27] = 16 + 3;
indices[28] = 16 + 2;
indices[29] = 16 + 0;
// -y face
indices[30] = 20 + 0;
indices[31] = 20 + 1;
indices[32] = 20 + 2;
indices[33] = 20 + 0;
indices[34] = 20 + 2;
indices[35] = 20 + 3;
} else {
// Positions only - no need to duplicate corner points
positions = new Float64Array(8 * 3);
positions[0] = min.x;
positions[1] = min.y;
positions[2] = min.z;
positions[3] = max.x;
positions[4] = min.y;
positions[5] = min.z;
positions[6] = max.x;
positions[7] = max.y;
positions[8] = min.z;
positions[9] = min.x;
positions[10] = max.y;
positions[11] = min.z;
positions[12] = min.x;
positions[13] = min.y;
positions[14] = max.z;
positions[15] = max.x;
positions[16] = min.y;
positions[17] = max.z;
positions[18] = max.x;
positions[19] = max.y;
positions[20] = max.z;
positions[21] = min.x;
positions[22] = max.y;
positions[23] = max.z;
attributes.position = new GeometryAttribute({
componentDatatype : ComponentDatatype.DOUBLE,
componentsPerAttribute : 3,
values : positions
});
// 12 triangles: 6 faces, 2 triangles each.
indices = new Uint16Array(6 * 2 * 3);
// plane z = corner.Z
indices[0] = 4;
indices[1] = 5;
indices[2] = 6;
indices[3] = 4;
indices[4] = 6;
indices[5] = 7;
// plane z = -corner.Z
indices[6] = 1;
indices[7] = 0;
indices[8] = 3;
indices[9] = 1;
indices[10] = 3;
indices[11] = 2;
// plane x = corner.X
indices[12] = 1;
indices[13] = 6;
indices[14] = 5;
indices[15] = 1;
indices[16] = 2;
indices[17] = 6;
// plane y = corner.Y
indices[18] = 2;
indices[19] = 3;
indices[20] = 7;
indices[21] = 2;
indices[22] = 7;
indices[23] = 6;
// plane x = -corner.X
indices[24] = 3;
indices[25] = 0;
indices[26] = 4;
indices[27] = 3;
indices[28] = 4;
indices[29] = 7;
// plane y = -corner.Y
indices[30] = 0;
indices[31] = 1;
indices[32] = 5;
indices[33] = 0;
indices[34] = 5;
indices[35] = 4;
}
var diff = Cartesian3.subtract(max, min, diffScratch);
var radius = Cartesian3.magnitude(diff) * 0.5;
return new Geometry({
attributes : attributes,
indices : indices,
primitiveType : PrimitiveType.TRIANGLES,
boundingSphere : new BoundingSphere(Cartesian3.ZERO, radius)
});
};
return BoxGeometry;
});
/*global define*/
define('Core/Color',[
'./defaultValue',
'./defined',
'./freezeObject',
'./DeveloperError',
'./FeatureDetection',
'./Math'
], function(
defaultValue,
defined,
freezeObject,
DeveloperError,
FeatureDetection,
CesiumMath) {
"use strict";
function hue2rgb(m1, m2, h) {
if (h < 0) {
h += 1;
}
if (h > 1) {
h -= 1;
}
if (h * 6 < 1) {
return m1 + (m2 - m1) * 6 * h;
}
if (h * 2 < 1) {
return m2;
}
if (h * 3 < 2) {
return m1 + (m2 - m1) * (2 / 3 - h) * 6;
}
return m1;
}
/**
* A color, specified using red, green, blue, and alpha values,
* which range from <code>0</code> (no intensity) to <code>1.0</code> (full intensity).
* @param {Number} [red=1.0] The red component.
* @param {Number} [green=1.0] The green component.
* @param {Number} [blue=1.0] The blue component.
* @param {Number} [alpha=1.0] The alpha component.
*
* @constructor
* @alias Color
*
* @see Packable
*/
var Color = function(red, green, blue, alpha) {
/**
* The red component.
* @type {Number}
* @default 1.0
*/
this.red = defaultValue(red, 1.0);
/**
* The green component.
* @type {Number}
* @default 1.0
*/
this.green = defaultValue(green, 1.0);
/**
* The blue component.
* @type {Number}
* @default 1.0
*/
this.blue = defaultValue(blue, 1.0);
/**
* The alpha component.
* @type {Number}
* @default 1.0
*/
this.alpha = defaultValue(alpha, 1.0);
};
/**
* Creates a new Color specified using red, green, blue, and alpha values
* that are in the range of 0 to 255, converting them internally to a range of 0.0 to 1.0.
* @memberof Color
*
* @param {Number} [red=255] The red component.
* @param {Number} [green=255] The green component.
* @param {Number} [blue=255] The blue component.
* @param {Number} [alpha=255] The alpha component.
* @returns {Color} A new color instance.
*/
Color.fromBytes = function(red, green, blue, alpha) {
red = Color.byteToFloat(defaultValue(red, 255.0));
green = Color.byteToFloat(defaultValue(green, 255.0));
blue = Color.byteToFloat(defaultValue(blue, 255.0));
alpha = Color.byteToFloat(defaultValue(alpha, 255.0));
return new Color(red, green, blue, alpha);
};
var scratchArrayBuffer;
var scratchUint32Array;
var scratchUint8Array;
if (FeatureDetection.supportsTypedArrays()) {
scratchArrayBuffer = new ArrayBuffer(4);
scratchUint32Array = new Uint32Array(scratchArrayBuffer);
scratchUint8Array = new Uint8Array(scratchArrayBuffer);
}
/**
* Creates a new Color from a single numeric unsigned 32-bit RGBA value, using the endianness
* of the system.
*
* @memberof Color
*
* @param {Number} rgba A single numeric unsigned 32-bit RGBA value.
* @returns {Color} A new color instance.
*
* @example
* var color = Color.fromRgba(0x67ADDFFF);
*
* @see Color#toRgba
*/
Color.fromRgba = function(rgba) {
// scratchUint32Array and scratchUint8Array share an underlying array buffer
scratchUint32Array[0] = rgba;
return Color.fromBytes(scratchUint8Array[0], scratchUint8Array[1], scratchUint8Array[2], scratchUint8Array[3]);
};
/**
* Creates a Color instance from hue, saturation, and lightness.
* @memberof Color
*
* @param {Number} [hue=0] The hue angle 0...1
* @param {Number} [saturation=0] The saturation value 0...1
* @param {Number} [lightness=0] The lightness value 0...1
* @param {Number} [alpha=1.0] The alpha component 0...1
* @returns {Color} The color object.
*
* @see <a href="http://www.w3.org/TR/css3-color/#hsl-color">CSS color values</a>
*/
Color.fromHsl = function(hue, saturation, lightness, alpha) {
hue = defaultValue(hue, 0.0) % 1.0;
saturation = defaultValue(saturation, 0.0);
lightness = defaultValue(lightness, 0.0);
alpha = defaultValue(alpha, 1.0);
var red = lightness;
var green = lightness;
var blue = lightness;
if (saturation !== 0) {
var m2;
if (lightness < 0.5) {
m2 = lightness * (1 + saturation);
} else {
m2 = lightness + saturation - lightness * saturation;
}
var m1 = 2.0 * lightness - m2;
red = hue2rgb(m1, m2, hue + 1 / 3);
green = hue2rgb(m1, m2, hue);
blue = hue2rgb(m1, m2, hue - 1 / 3);
}
return new Color(red, green, blue, alpha);
};
/**
* Creates a random color using the provided options. For reproducible random colors, you should
* call {@link CesiumMath#setRandomNumberSeed} once at the beginning of your application.
* @memberof Color
*
* @param {Object} [options] Object containing the options.
* @param {Number} [options.red] If specified, the red component to use instead of a randomized value.
* @param {Number} [options.minimumRed=0.0] The maximum red value to generate if none was specified.
* @param {Number} [options.maximumRed=1.0] The minimum red value to generate if none was specified.
* @param {Number} [options.green] If specified, the green component to use instead of a randomized value.
* @param {Number} [options.minimumGreen=0.0] The maximum green value to generate if none was specified.
* @param {Number} [options.maximumGreen=1.0] The minimum green value to generate if none was specified.
* @param {Number} [options.blue] If specified, the blue component to use instead of a randomized value.
* @param {Number} [options.minimumBlue=0.0] The maximum blue value to generate if none was specified.
* @param {Number} [options.maximumBlue=1.0] The minimum blue value to generate if none was specified.
* @param {Number} [options.alpha] If specified, the alpha component to use instead of a randomized value.
* @param {Number} [options.minimumAlpha=0.0] The maximum alpha value to generate if none was specified.
* @param {Number} [options.maximumAlpha=1.0] The minimum alpha value to generate if none was specified.
* @param {Color} [result] The object to store the result in, if undefined a new instance will be created.
*
* @returns {Color} The modified result parameter or a new instance if result was undefined.
*
* @exception {DeveloperError} minimumRed must be less than or equal to maximumRed.
* @exception {DeveloperError} minimumGreen must be less than or equal to maximumGreen.
* @exception {DeveloperError} minimumBlue must be less than or equal to maximumBlue.
* @exception {DeveloperError} minimumAlpha must be less than or equal to maximumAlpha.
*
* @example
* //Create a completely random color
* var color = Color.fromRandom();
*
* //Create a random shade of yellow.
* var color = Color.fromRandom({
* red : 1.0,
* green : 1.0,
* alpha : 1.0
* });
*
* //Create a random bright color.
* var color = Color.fromRandom({
* minimumRed : 0.75,
* minimumGreen : 0.75,
* minimumBlue : 0.75,
* alpha : 1.0
* });
*/
Color.fromRandom = function(options, result) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
var red = options.red;
if (!defined(red)) {
var minimumRed = defaultValue(options.minimumRed, 0);
var maximumRed = defaultValue(options.maximumRed, 1.0);
if (minimumRed > maximumRed) {
throw new DeveloperError("minimumRed must be less than or equal to maximumRed");
}
red = minimumRed + (CesiumMath.nextRandomNumber() * (maximumRed - minimumRed));
}
var green = options.green;
if (!defined(green)) {
var minimumGreen = defaultValue(options.minimumGreen, 0);
var maximumGreen = defaultValue(options.maximumGreen, 1.0);
if (minimumGreen > maximumGreen) {
throw new DeveloperError("minimumGreen must be less than or equal to maximumGreen");
}
green = minimumGreen + (CesiumMath.nextRandomNumber() * (maximumGreen - minimumGreen));
}
var blue = options.blue;
if (!defined(blue)) {
var minimumBlue = defaultValue(options.minimumBlue, 0);
var maximumBlue = defaultValue(options.maximumBlue, 1.0);
if (minimumBlue > maximumBlue) {
throw new DeveloperError("minimumBlue must be less than or equal to maximumBlue");
}
blue = minimumBlue + (CesiumMath.nextRandomNumber() * (maximumBlue - minimumBlue));
}
var alpha = options.alpha;
if (!defined(alpha)) {
var minimumAlpha = defaultValue(options.minimumAlpha, 0);
var maximumAlpha = defaultValue(options.maximumAlpha, 1.0);
if (minimumAlpha > maximumAlpha) {
throw new DeveloperError("minimumAlpha must be less than or equal to maximumAlpha");
}
alpha = minimumAlpha + (CesiumMath.nextRandomNumber() * (maximumAlpha - minimumAlpha));
}
if (!defined(result)) {
return new Color(red, green, blue, alpha);
}
result.red = red;
result.green = green;
result.blue = blue;
result.alpha = alpha;
return result;
};
//#rgb
var rgbMatcher = /^#([0-9a-f])([0-9a-f])([0-9a-f])$/i;
//#rrggbb
var rrggbbMatcher = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i;
//rgb(), rgba(), or rgb%()
var rgbParenthesesMatcher = /^rgba?\(\s*([0-9.]+%?)\s*,\s*([0-9.]+%?)\s*,\s*([0-9.]+%?)(?:\s*,\s*([0-9.]+))?\s*\)$/i;
//hsl(), hsla(), or hsl%()
var hslParenthesesMatcher = /^hsla?\(\s*([0-9.]+)\s*,\s*([0-9.]+%)\s*,\s*([0-9.]+%)(?:\s*,\s*([0-9.]+))?\s*\)$/i;
/**
* Creates a Color instance from a CSS color value.
* @memberof Color
*
* @param {String} color The CSS color value in #rgb, #rrggbb, rgb(), rgba(), hsl(), or hsla() format.
* @returns {Color} The color object, or undefined if the string was not a valid CSS color.
*
* @exception {DeveloperError} color is required.
*
* @example
* var cesiumBlue = Color.fromCssColorString('#67ADDF');
* var green = Color.fromCssColorString('green');
*
* @see <a href="http://www.w3.org/TR/css3-color">CSS color values</a>
*/
Color.fromCssColorString = function(color) {
if (!defined(color)) {
throw new DeveloperError('color is required');
}
var namedColor = Color[color.toUpperCase()];
if (defined(namedColor)) {
return namedColor.clone();
}
var matches = rgbMatcher.exec(color);
if (matches !== null) {
return new Color(parseInt(matches[1], 16) / 15.0,
parseInt(matches[2], 16) / 15.0,
parseInt(matches[3], 16) / 15.0);
}
matches = rrggbbMatcher.exec(color);
if (matches !== null) {
return new Color(parseInt(matches[1], 16) / 255.0,
parseInt(matches[2], 16) / 255.0,
parseInt(matches[3], 16) / 255.0);
}
matches = rgbParenthesesMatcher.exec(color);
if (matches !== null) {
return new Color(parseFloat(matches[1]) / ('%' === matches[1].substr(-1) ? 100.0 : 255.0),
parseFloat(matches[2]) / ('%' === matches[2].substr(-1) ? 100.0 : 255.0),
parseFloat(matches[3]) / ('%' === matches[3].substr(-1) ? 100.0 : 255.0),
parseFloat(defaultValue(matches[4], '1.0')));
}
matches = hslParenthesesMatcher.exec(color);
if (matches !== null) {
return Color.fromHsl(parseFloat(matches[1]) / 360.0,
parseFloat(matches[2]) / 100.0,
parseFloat(matches[3]) / 100.0,
parseFloat(defaultValue(matches[4], '1.0')));
}
return undefined;
};
/**
* The number of elements used to pack the object into an array.
* @Type {Number}
*/
Color.packedLength = 4;
/**
* Stores the provided instance into the provided array.
* @memberof Color
*
* @param {Color} value The value to pack.
* @param {Array} array The array to pack into.
* @param {Number} [startingIndex=0] The index into the array at which to start packing the elements.
*
* @exception {DeveloperError} value is required.
* @exception {DeveloperError} array is required.
*/
Color.pack = function(value, array, startingIndex) {
if (!defined(value)) {
throw new DeveloperError('value is required');
}
if (!defined(array)) {
throw new DeveloperError('array is required');
}
startingIndex = defaultValue(startingIndex, 0);
array[startingIndex++] = value.red;
array[startingIndex++] = value.green;
array[startingIndex++] = value.blue;
array[startingIndex] = value.alpha;
};
/**
* Retrieves an instance from a packed array.
* @memberof Color
*
* @param {Array} array The packed array.
* @param {Number} [startingIndex=0] The starting index of the element to be unpacked.
* @param {Color} [result] The object into which to store the result.
*
* @exception {DeveloperError} array is required.
*/
Color.unpack = function(array, startingIndex, result) {
if (!defined(array)) {
throw new DeveloperError('array is required');
}
startingIndex = defaultValue(startingIndex, 0);
if (!defined(result)) {
result = new Color();
}
result.red = array[startingIndex++];
result.green = array[startingIndex++];
result.blue = array[startingIndex++];
result.alpha = array[startingIndex];
return result;
};
/**
* Converts a 'byte' color component in the range of 0 to 255 into
* a 'float' color component in the range of 0 to 1.0.
* @memberof Color
*
* @param {Number} number The number to be converted.
* @returns {number} The converted number.
*/
Color.byteToFloat = function(number) {
return number / 255.0;
};
/**
* Converts a 'float' color component in the range of 0 to 1.0 into
* a 'byte' color component in the range of 0 to 255.
* @memberof Color
*
* @param {Number} number The number to be converted.
* @returns {number} The converted number.
*/
Color.floatToByte = function(number) {
return number === 1.0 ? 255.0 : (number * 256.0) | 0;
};
/**
* Duplicates a Color.
* @memberof Color
*
* @param {Color} color The Color to duplicate.
* @param {Color} [result] The object to store the result in, if undefined a new instance will be created.
* @returns {Color} The modified result parameter or a new instance if result was undefined. (Returns undefined if color is undefined)
*/
Color.clone = function(color, result) {
if (!defined(color)) {
return undefined;
}
if (!defined(result)) {
return new Color(color.red, color.green, color.blue, color.alpha);
}
result.red = color.red;
result.green = color.green;
result.blue = color.blue;
result.alpha = color.alpha;
return result;
};
/**
* Returns true if the first Color equals the second color.
* @memberof Color
*
* @param {Color} left The first Color to compare for equality.
* @param {Color} right The second Color to compare for equality.
* @returns {Boolean} <code>true</code> if the Colors are equal; otherwise, <code>false</code>.
*/
Color.equals = function(left, right) {
return (left === right) || //
(defined(left) && //
defined(right) && //
left.red === right.red && //
left.green === right.green && //
left.blue === right.blue && //
left.alpha === right.alpha);
};
/**
* Returns a duplicate of a Color instance.
* @memberof Color
*
* @param {Color} [result] The object to store the result in, if undefined a new instance will be created.
* @returns {Color} The modified result parameter or a new instance if result was undefined.
*/
Color.prototype.clone = function(result) {
return Color.clone(this, result);
};
/**
* Returns true if this Color equals other.
* @memberof Color
*
* @param {Color} other The Color to compare for equality.
* @returns {Boolean} <code>true</code> if the Colors are equal; otherwise, <code>false</code>.
*/
Color.prototype.equals = function(other) {
return Color.equals(this, other);
};
/**
* Returns <code>true</code> if this Color equals other componentwise within the specified epsilon.
* @memberof Color
*
* @param {Color} other The Color to compare for equality.
* @param {Number} [epsilon=0.0] The epsilon to use for equality testing.
* @returns {Boolean} <code>true</code> if the Colors are equal within the specified epsilon; otherwise, <code>false</code>.
*/
Color.prototype.equalsEpsilon = function(other, epsilon) {
return (this === other) || //
((defined(other)) && //
(Math.abs(this.red - other.red) <= epsilon) && //
(Math.abs(this.green - other.green) <= epsilon) && //
(Math.abs(this.blue - other.blue) <= epsilon) && //
(Math.abs(this.alpha - other.alpha) <= epsilon));
};
/**
* Creates a string representing this Color in the format '(red, green, blue, alpha)'.
* @memberof Color
*
* @returns {String} A string representing this Color in the format '(red, green, blue, alpha)'.
*/
Color.prototype.toString = function() {
return '(' + this.red + ', ' + this.green + ', ' + this.blue + ', ' + this.alpha + ')';
};
/**
* Creates a string containing the CSS color value for this color.
* @memberof Color
*
* @returns {String} The CSS equivalent of this color.
* @see <a href="http://www.w3.org/TR/css3-color/#rgba-color">CSS RGB or RGBA color values</a>
*/
Color.prototype.toCssColorString = function() {
var red = Color.floatToByte(this.red);
var green = Color.floatToByte(this.green);
var blue = Color.floatToByte(this.blue);
if (this.alpha === 1) {
return 'rgb(' + red + ',' + green + ',' + blue + ')';
}
return 'rgba(' + red + ',' + green + ',' + blue + ',' + this.alpha + ')';
};
/**
* Converts this color to an array of red, green, blue, and alpha values
* that are in the range of 0 to 255.
* @memberof Color
*
* @returns {Array} An array containing the red, green, blue, alpha values in the range 0 to 255.
*/
Color.prototype.toBytes = function() {
var red = Color.floatToByte(this.red);
var green = Color.floatToByte(this.green);
var blue = Color.floatToByte(this.blue);
var alpha = Color.floatToByte(this.alpha);
return [red, green, blue, alpha];
};
/**
* Converts this color to a single numeric unsigned 32-bit RGBA value, using the endianness
* of the system.
*
* @memberof Color
*
* @returns {Number} A single numeric unsigned 32-bit RGBA value.
*
* @example
* var rgba = Color.BLUE.toRgba();
*
* @see Color.fromRgba
*/
Color.prototype.toRgba = function() {
// scratchUint32Array and scratchUint8Array share an underlying array buffer
scratchUint8Array[0] = Color.floatToByte(this.red);
scratchUint8Array[1] = Color.floatToByte(this.green);
scratchUint8Array[2] = Color.floatToByte(this.blue);
scratchUint8Array[3] = Color.floatToByte(this.alpha);
return scratchUint32Array[0];
};
/**
* An immutable Color instance initialized to CSS color #F0F8FF
* <span class="colorSwath" style="background: #F0F8FF;"></span>
*
* @constant
* @type {Color}
*/
Color.ALICEBLUE = freezeObject(Color.fromCssColorString('#F0F8FF'));
/**
* An immutable Color instance initialized to CSS color #FAEBD7
* <span class="colorSwath" style="background: #FAEBD7;"></span>
*
* @constant
* @type {Color}
*/
Color.ANTIQUEWHITE = freezeObject(Color.fromCssColorString('#FAEBD7'));
/**
* An immutable Color instance initialized to CSS color #00FFFF
* <span class="colorSwath" style="background: #00FFFF;"></span>
*
* @constant
* @type {Color}
*/
Color.AQUA = freezeObject(Color.fromCssColorString('#00FFFF'));
/**
* An immutable Color instance initialized to CSS color #7FFFD4
* <span class="colorSwath" style="background: #7FFFD4;"></span>
*
* @constant
* @type {Color}
*/
Color.AQUAMARINE = freezeObject(Color.fromCssColorString('#7FFFD4'));
/**
* An immutable Color instance initialized to CSS color #F0FFFF
* <span class="colorSwath" style="background: #F0FFFF;"></span>
*
* @constant
* @type {Color}
*/
Color.AZURE = freezeObject(Color.fromCssColorString('#F0FFFF'));
/**
* An immutable Color instance initialized to CSS color #F5F5DC
* <span class="colorSwath" style="background: #F5F5DC;"></span>
*
* @constant
* @type {Color}
*/
Color.BEIGE = freezeObject(Color.fromCssColorString('#F5F5DC'));
/**
* An immutable Color instance initialized to CSS color #FFE4C4
* <span class="colorSwath" style="background: #FFE4C4;"></span>
*
* @constant
* @type {Color}
*/
Color.BISQUE = freezeObject(Color.fromCssColorString('#FFE4C4'));
/**
* An immutable Color instance initialized to CSS color #000000
* <span class="colorSwath" style="background: #000000;"></span>
*
* @constant
* @type {Color}
*/
Color.BLACK = freezeObject(Color.fromCssColorString('#000000'));
/**
* An immutable Color instance initialized to CSS color #FFEBCD
* <span class="colorSwath" style="background: #FFEBCD;"></span>
*
* @constant
* @type {Color}
*/
Color.BLANCHEDALMOND = freezeObject(Color.fromCssColorString('#FFEBCD'));
/**
* An immutable Color instance initialized to CSS color #0000FF
* <span class="colorSwath" style="background: #0000FF;"></span>
*
* @constant
* @type {Color}
*/
Color.BLUE = freezeObject(Color.fromCssColorString('#0000FF'));
/**
* An immutable Color instance initialized to CSS color #8A2BE2
* <span class="colorSwath" style="background: #8A2BE2;"></span>
*
* @constant
* @type {Color}
*/
Color.BLUEVIOLET = freezeObject(Color.fromCssColorString('#8A2BE2'));
/**
* An immutable Color instance initialized to CSS color #A52A2A
* <span class="colorSwath" style="background: #A52A2A;"></span>
*
* @constant
* @type {Color}
*/
Color.BROWN = freezeObject(Color.fromCssColorString('#A52A2A'));
/**
* An immutable Color instance initialized to CSS color #DEB887
* <span class="colorSwath" style="background: #DEB887;"></span>
*
* @constant
* @type {Color}
*/
Color.BURLYWOOD = freezeObject(Color.fromCssColorString('#DEB887'));
/**
* An immutable Color instance initialized to CSS color #5F9EA0
* <span class="colorSwath" style="background: #5F9EA0;"></span>
*
* @constant
* @type {Color}
*/
Color.CADETBLUE = freezeObject(Color.fromCssColorString('#5F9EA0'));
/**
* An immutable Color instance initialized to CSS color #7FFF00
* <span class="colorSwath" style="background: #7FFF00;"></span>
*
* @constant
* @type {Color}
*/
Color.CHARTREUSE = freezeObject(Color.fromCssColorString('#7FFF00'));
/**
* An immutable Color instance initialized to CSS color #D2691E
* <span class="colorSwath" style="background: #D2691E;"></span>
*
* @constant
* @type {Color}
*/
Color.CHOCOLATE = freezeObject(Color.fromCssColorString('#D2691E'));
/**
* An immutable Color instance initialized to CSS color #FF7F50
* <span class="colorSwath" style="background: #FF7F50;"></span>
*
* @constant
* @type {Color}
*/
Color.CORAL = freezeObject(Color.fromCssColorString('#FF7F50'));
/**
* An immutable Color instance initialized to CSS color #6495ED
* <span class="colorSwath" style="background: #6495ED;"></span>
*
* @constant
* @type {Color}
*/
Color.CORNFLOWERBLUE = freezeObject(Color.fromCssColorString('#6495ED'));
/**
* An immutable Color instance initialized to CSS color #FFF8DC
* <span class="colorSwath" style="background: #FFF8DC;"></span>
*
* @constant
* @type {Color}
*/
Color.CORNSILK = freezeObject(Color.fromCssColorString('#FFF8DC'));
/**
* An immutable Color instance initialized to CSS color #DC143C
* <span class="colorSwath" style="background: #DC143C;"></span>
*
* @constant
* @type {Color}
*/
Color.CRIMSON = freezeObject(Color.fromCssColorString('#DC143C'));
/**
* An immutable Color instance initialized to CSS color #00FFFF
* <span class="colorSwath" style="background: #00FFFF;"></span>
*
* @constant
* @type {Color}
*/
Color.CYAN = freezeObject(Color.fromCssColorString('#00FFFF'));
/**
* An immutable Color instance initialized to CSS color #00008B
* <span class="colorSwath" style="background: #00008B;"></span>
*
* @constant
* @type {Color}
*/
Color.DARKBLUE = freezeObject(Color.fromCssColorString('#00008B'));
/**
* An immutable Color instance initialized to CSS color #008B8B
* <span class="colorSwath" style="background: #008B8B;"></span>
*
* @constant
* @type {Color}
*/
Color.DARKCYAN = freezeObject(Color.fromCssColorString('#008B8B'));
/**
* An immutable Color instance initialized to CSS color #B8860B
* <span class="colorSwath" style="background: #B8860B;"></span>
*
* @constant
* @type {Color}
*/
Color.DARKGOLDENROD = freezeObject(Color.fromCssColorString('#B8860B'));
/**
* An immutable Color instance initialized to CSS color #A9A9A9
* <span class="colorSwath" style="background: #A9A9A9;"></span>
*
* @constant
* @type {Color}
*/
Color.DARKGRAY = freezeObject(Color.fromCssColorString('#A9A9A9'));
/**
* An immutable Color instance initialized to CSS color #006400
* <span class="colorSwath" style="background: #006400;"></span>
*
* @constant
* @type {Color}
*/
Color.DARKGREEN = freezeObject(Color.fromCssColorString('#006400'));
/**
* An immutable Color instance initialized to CSS color #A9A9A9
* <span class="colorSwath" style="background: #A9A9A9;"></span>
*
* @constant
* @type {Color}
*/
Color.DARKGREY = Color.DARKGRAY;
/**
* An immutable Color instance initialized to CSS color #BDB76B
* <span class="colorSwath" style="background: #BDB76B;"></span>
*
* @constant
* @type {Color}
*/
Color.DARKKHAKI = freezeObject(Color.fromCssColorString('#BDB76B'));
/**
* An immutable Color instance initialized to CSS color #8B008B
* <span class="colorSwath" style="background: #8B008B;"></span>
*
* @constant
* @type {Color}
*/
Color.DARKMAGENTA = freezeObject(Color.fromCssColorString('#8B008B'));
/**
* An immutable Color instance initialized to CSS color #556B2F
* <span class="colorSwath" style="background: #556B2F;"></span>
*
* @constant
* @type {Color}
*/
Color.DARKOLIVEGREEN = freezeObject(Color.fromCssColorString('#556B2F'));
/**
* An immutable Color instance initialized to CSS color #FF8C00
* <span class="colorSwath" style="background: #FF8C00;"></span>
*
* @constant
* @type {Color}
*/
Color.DARKORANGE = freezeObject(Color.fromCssColorString('#FF8C00'));
/**
* An immutable Color instance initialized to CSS color #9932CC
* <span class="colorSwath" style="background: #9932CC;"></span>
*
* @constant
* @type {Color}
*/
Color.DARKORCHID = freezeObject(Color.fromCssColorString('#9932CC'));
/**
* An immutable Color instance initialized to CSS color #8B0000
* <span class="colorSwath" style="background: #8B0000;"></span>
*
* @constant
* @type {Color}
*/
Color.DARKRED = freezeObject(Color.fromCssColorString('#8B0000'));
/**
* An immutable Color instance initialized to CSS color #E9967A
* <span class="colorSwath" style="background: #E9967A;"></span>
*
* @constant
* @type {Color}
*/
Color.DARKSALMON = freezeObject(Color.fromCssColorString('#E9967A'));
/**
* An immutable Color instance initialized to CSS color #8FBC8F
* <span class="colorSwath" style="background: #8FBC8F;"></span>
*
* @constant
* @type {Color}
*/
Color.DARKSEAGREEN = freezeObject(Color.fromCssColorString('#8FBC8F'));
/**
* An immutable Color instance initialized to CSS color #483D8B
* <span class="colorSwath" style="background: #483D8B;"></span>
*
* @constant
* @type {Color}
*/
Color.DARKSLATEBLUE = freezeObject(Color.fromCssColorString('#483D8B'));
/**
* An immutable Color instance initialized to CSS color #2F4F4F
* <span class="colorSwath" style="background: #2F4F4F;"></span>
*
* @constant
* @type {Color}
*/
Color.DARKSLATEGRAY = freezeObject(Color.fromCssColorString('#2F4F4F'));
/**
* An immutable Color instance initialized to CSS color #2F4F4F
* <span class="colorSwath" style="background: #2F4F4F;"></span>
*
* @constant
* @type {Color}
*/
Color.DARKSLATEGREY = Color.DARKSLATEGRAY;
/**
* An immutable Color instance initialized to CSS color #00CED1
* <span class="colorSwath" style="background: #00CED1;"></span>
*
* @constant
* @type {Color}
*/
Color.DARKTURQUOISE = freezeObject(Color.fromCssColorString('#00CED1'));
/**
* An immutable Color instance initialized to CSS color #9400D3
* <span class="colorSwath" style="background: #9400D3;"></span>
*
* @constant
* @type {Color}
*/
Color.DARKVIOLET = freezeObject(Color.fromCssColorString('#9400D3'));
/**
* An immutable Color instance initialized to CSS color #FF1493
* <span class="colorSwath" style="background: #FF1493;"></span>
*
* @constant
* @type {Color}
*/
Color.DEEPPINK = freezeObject(Color.fromCssColorString('#FF1493'));
/**
* An immutable Color instance initialized to CSS color #00BFFF
* <span class="colorSwath" style="background: #00BFFF;"></span>
*
* @constant
* @type {Color}
*/
Color.DEEPSKYBLUE = freezeObject(Color.fromCssColorString('#00BFFF'));
/**
* An immutable Color instance initialized to CSS color #696969
* <span class="colorSwath" style="background: #696969;"></span>
*
* @constant
* @type {Color}
*/
Color.DIMGRAY = freezeObject(Color.fromCssColorString('#696969'));
/**
* An immutable Color instance initialized to CSS color #696969
* <span class="colorSwath" style="background: #696969;"></span>
*
* @constant
* @type {Color}
*/
Color.DIMGREY = Color.DIMGRAY;
/**
* An immutable Color instance initialized to CSS color #1E90FF
* <span class="colorSwath" style="background: #1E90FF;"></span>
*
* @constant
* @type {Color}
*/
Color.DODGERBLUE = freezeObject(Color.fromCssColorString('#1E90FF'));
/**
* An immutable Color instance initialized to CSS color #B22222
* <span class="colorSwath" style="background: #B22222;"></span>
*
* @constant
* @type {Color}
*/
Color.FIREBRICK = freezeObject(Color.fromCssColorString('#B22222'));
/**
* An immutable Color instance initialized to CSS color #FFFAF0
* <span class="colorSwath" style="background: #FFFAF0;"></span>
*
* @constant
* @type {Color}
*/
Color.FLORALWHITE = freezeObject(Color.fromCssColorString('#FFFAF0'));
/**
* An immutable Color instance initialized to CSS color #228B22
* <span class="colorSwath" style="background: #228B22;"></span>
*
* @constant
* @type {Color}
*/
Color.FORESTGREEN = freezeObject(Color.fromCssColorString('#228B22'));
/**
* An immutable Color instance initialized to CSS color #FF00FF
* <span class="colorSwath" style="background: #FF00FF;"></span>
*
* @constant
* @type {Color}
*/
Color.FUSCHIA = freezeObject(Color.fromCssColorString('#FF00FF'));
/**
* An immutable Color instance initialized to CSS color #DCDCDC
* <span class="colorSwath" style="background: #DCDCDC;"></span>
*
* @constant
* @type {Color}
*/
Color.GAINSBORO = freezeObject(Color.fromCssColorString('#DCDCDC'));
/**
* An immutable Color instance initialized to CSS color #F8F8FF
* <span class="colorSwath" style="background: #F8F8FF;"></span>
*
* @constant
* @type {Color}
*/
Color.GHOSTWHITE = freezeObject(Color.fromCssColorString('#F8F8FF'));
/**
* An immutable Color instance initialized to CSS color #FFD700
* <span class="colorSwath" style="background: #FFD700;"></span>
*
* @constant
* @type {Color}
*/
Color.GOLD = freezeObject(Color.fromCssColorString('#FFD700'));
/**
* An immutable Color instance initialized to CSS color #DAA520
* <span class="colorSwath" style="background: #DAA520;"></span>
*
* @constant
* @type {Color}
*/
Color.GOLDENROD = freezeObject(Color.fromCssColorString('#DAA520'));
/**
* An immutable Color instance initialized to CSS color #808080
* <span class="colorSwath" style="background: #808080;"></span>
*
* @constant
* @type {Color}
*/
Color.GRAY = freezeObject(Color.fromCssColorString('#808080'));
/**
* An immutable Color instance initialized to CSS color #008000
* <span class="colorSwath" style="background: #008000;"></span>
*
* @constant
* @type {Color}
*/
Color.GREEN = freezeObject(Color.fromCssColorString('#008000'));
/**
* An immutable Color instance initialized to CSS color #ADFF2F
* <span class="colorSwath" style="background: #ADFF2F;"></span>
*
* @constant
* @type {Color}
*/
Color.GREENYELLOW = freezeObject(Color.fromCssColorString('#ADFF2F'));
/**
* An immutable Color instance initialized to CSS color #808080
* <span class="colorSwath" style="background: #808080;"></span>
*
* @constant
* @type {Color}
*/
Color.GREY = Color.GRAY;
/**
* An immutable Color instance initialized to CSS color #F0FFF0
* <span class="colorSwath" style="background: #F0FFF0;"></span>
*
* @constant
* @type {Color}
*/
Color.HONEYDEW = freezeObject(Color.fromCssColorString('#F0FFF0'));
/**
* An immutable Color instance initialized to CSS color #FF69B4
* <span class="colorSwath" style="background: #FF69B4;"></span>
*
* @constant
* @type {Color}
*/
Color.HOTPINK = freezeObject(Color.fromCssColorString('#FF69B4'));
/**
* An immutable Color instance initialized to CSS color #CD5C5C
* <span class="colorSwath" style="background: #CD5C5C;"></span>
*
* @constant
* @type {Color}
*/
Color.INDIANRED = freezeObject(Color.fromCssColorString('#CD5C5C'));
/**
* An immutable Color instance initialized to CSS color #4B0082
* <span class="colorSwath" style="background: #4B0082;"></span>
*
* @constant
* @type {Color}
*/
Color.INDIGO = freezeObject(Color.fromCssColorString('#4B0082'));
/**
* An immutable Color instance initialized to CSS color #FFFFF0
* <span class="colorSwath" style="background: #FFFFF0;"></span>
*
* @constant
* @type {Color}
*/
Color.IVORY = freezeObject(Color.fromCssColorString('#FFFFF0'));
/**
* An immutable Color instance initialized to CSS color #F0E68C
* <span class="colorSwath" style="background: #F0E68C;"></span>
*
* @constant
* @type {Color}
*/
Color.KHAKI = freezeObject(Color.fromCssColorString('#F0E68C'));
/**
* An immutable Color instance initialized to CSS color #E6E6FA
* <span class="colorSwath" style="background: #E6E6FA;"></span>
*
* @constant
* @type {Color}
*/
Color.LAVENDER = freezeObject(Color.fromCssColorString('#E6E6FA'));
/**
* An immutable Color instance initialized to CSS color #FFF0F5
* <span class="colorSwath" style="background: #FFF0F5;"></span>
*
* @constant
* @type {Color}
*/
Color.LAVENDAR_BLUSH = freezeObject(Color.fromCssColorString('#FFF0F5'));
/**
* An immutable Color instance initialized to CSS color #7CFC00
* <span class="colorSwath" style="background: #7CFC00;"></span>
*
* @constant
* @type {Color}
*/
Color.LAWNGREEN = freezeObject(Color.fromCssColorString('#7CFC00'));
/**
* An immutable Color instance initialized to CSS color #FFFACD
* <span class="colorSwath" style="background: #FFFACD;"></span>
*
* @constant
* @type {Color}
*/
Color.LEMONCHIFFON = freezeObject(Color.fromCssColorString('#FFFACD'));
/**
* An immutable Color instance initialized to CSS color #ADD8E6
* <span class="colorSwath" style="background: #ADD8E6;"></span>
*
* @constant
* @type {Color}
*/
Color.LIGHTBLUE = freezeObject(Color.fromCssColorString('#ADD8E6'));
/**
* An immutable Color instance initialized to CSS color #F08080
* <span class="colorSwath" style="background: #F08080;"></span>
*
* @constant
* @type {Color}
*/
Color.LIGHTCORAL = freezeObject(Color.fromCssColorString('#F08080'));
/**
* An immutable Color instance initialized to CSS color #E0FFFF
* <span class="colorSwath" style="background: #E0FFFF;"></span>
*
* @constant
* @type {Color}
*/
Color.LIGHTCYAN = freezeObject(Color.fromCssColorString('#E0FFFF'));
/**
* An immutable Color instance initialized to CSS color #FAFAD2
* <span class="colorSwath" style="background: #FAFAD2;"></span>
*
* @constant
* @type {Color}
*/
Color.LIGHTGOLDENRODYELLOW = freezeObject(Color.fromCssColorString('#FAFAD2'));
/**
* An immutable Color instance initialized to CSS color #D3D3D3
* <span class="colorSwath" style="background: #D3D3D3;"></span>
*
* @constant
* @type {Color}
*/
Color.LIGHTGRAY = freezeObject(Color.fromCssColorString('#D3D3D3'));
/**
* An immutable Color instance initialized to CSS color #90EE90
* <span class="colorSwath" style="background: #90EE90;"></span>
*
* @constant
* @type {Color}
*/
Color.LIGHTGREEN = freezeObject(Color.fromCssColorString('#90EE90'));
/**
* An immutable Color instance initialized to CSS color #D3D3D3
* <span class="colorSwath" style="background: #D3D3D3;"></span>
*
* @constant
* @type {Color}
*/
Color.LIGHTGREY = Color.LIGHTGRAY;
/**
* An immutable Color instance initialized to CSS color #FFB6C1
* <span class="colorSwath" style="background: #FFB6C1;"></span>
*
* @constant
* @type {Color}
*/
Color.LIGHTPINK = freezeObject(Color.fromCssColorString('#FFB6C1'));
/**
* An immutable Color instance initialized to CSS color #20B2AA
* <span class="colorSwath" style="background: #20B2AA;"></span>
*
* @constant
* @type {Color}
*/
Color.LIGHTSEAGREEN = freezeObject(Color.fromCssColorString('#20B2AA'));
/**
* An immutable Color instance initialized to CSS color #87CEFA
* <span class="colorSwath" style="background: #87CEFA;"></span>
*
* @constant
* @type {Color}
*/
Color.LIGHTSKYBLUE = freezeObject(Color.fromCssColorString('#87CEFA'));
/**
* An immutable Color instance initialized to CSS color #778899
* <span class="colorSwath" style="background: #778899;"></span>
*
* @constant
* @type {Color}
*/
Color.LIGHTSLATEGRAY = freezeObject(Color.fromCssColorString('#778899'));
/**
* An immutable Color instance initialized to CSS color #778899
* <span class="colorSwath" style="background: #778899;"></span>
*
* @constant
* @type {Color}
*/
Color.LIGHTSLATEGREY = Color.LIGHTSLATEGRAY;
/**
* An immutable Color instance initialized to CSS color #B0C4DE
* <span class="colorSwath" style="background: #B0C4DE;"></span>
*
* @constant
* @type {Color}
*/
Color.LIGHTSTEELBLUE = freezeObject(Color.fromCssColorString('#B0C4DE'));
/**
* An immutable Color instance initialized to CSS color #FFFFE0
* <span class="colorSwath" style="background: #FFFFE0;"></span>
*
* @constant
* @type {Color}
*/
Color.LIGHTYELLOW = freezeObject(Color.fromCssColorString('#FFFFE0'));
/**
* An immutable Color instance initialized to CSS color #00FF00
* <span class="colorSwath" style="background: #00FF00;"></span>
*
* @constant
* @type {Color}
*/
Color.LIME = freezeObject(Color.fromCssColorString('#00FF00'));
/**
* An immutable Color instance initialized to CSS color #32CD32
* <span class="colorSwath" style="background: #32CD32;"></span>
*
* @constant
* @type {Color}
*/
Color.LIMEGREEN = freezeObject(Color.fromCssColorString('#32CD32'));
/**
* An immutable Color instance initialized to CSS color #FAF0E6
* <span class="colorSwath" style="background: #FAF0E6;"></span>
*
* @constant
* @type {Color}
*/
Color.LINEN = freezeObject(Color.fromCssColorString('#FAF0E6'));
/**
* An immutable Color instance initialized to CSS color #FF00FF
* <span class="colorSwath" style="background: #FF00FF;"></span>
*
* @constant
* @type {Color}
*/
Color.MAGENTA = freezeObject(Color.fromCssColorString('#FF00FF'));
/**
* An immutable Color instance initialized to CSS color #800000
* <span class="colorSwath" style="background: #800000;"></span>
*
* @constant
* @type {Color}
*/
Color.MAROON = freezeObject(Color.fromCssColorString('#800000'));
/**
* An immutable Color instance initialized to CSS color #66CDAA
* <span class="colorSwath" style="background: #66CDAA;"></span>
*
* @constant
* @type {Color}
*/
Color.MEDIUMAQUAMARINE = freezeObject(Color.fromCssColorString('#66CDAA'));
/**
* An immutable Color instance initialized to CSS color #0000CD
* <span class="colorSwath" style="background: #0000CD;"></span>
*
* @constant
* @type {Color}
*/
Color.MEDIUMBLUE = freezeObject(Color.fromCssColorString('#0000CD'));
/**
* An immutable Color instance initialized to CSS color #BA55D3
* <span class="colorSwath" style="background: #BA55D3;"></span>
*
* @constant
* @type {Color}
*/
Color.MEDIUMORCHID = freezeObject(Color.fromCssColorString('#BA55D3'));
/**
* An immutable Color instance initialized to CSS color #9370DB
* <span class="colorSwath" style="background: #9370DB;"></span>
*
* @constant
* @type {Color}
*/
Color.MEDIUMPURPLE = freezeObject(Color.fromCssColorString('#9370DB'));
/**
* An immutable Color instance initialized to CSS color #3CB371
* <span class="colorSwath" style="background: #3CB371;"></span>
*
* @constant
* @type {Color}
*/
Color.MEDIUMSEAGREEN = freezeObject(Color.fromCssColorString('#3CB371'));
/**
* An immutable Color instance initialized to CSS color #7B68EE
* <span class="colorSwath" style="background: #7B68EE;"></span>
*
* @constant
* @type {Color}
*/
Color.MEDIUMSLATEBLUE = freezeObject(Color.fromCssColorString('#7B68EE'));
/**
* An immutable Color instance initialized to CSS color #00FA9A
* <span class="colorSwath" style="background: #00FA9A;"></span>
*
* @constant
* @type {Color}
*/
Color.MEDIUMSPRINGGREEN = freezeObject(Color.fromCssColorString('#00FA9A'));
/**
* An immutable Color instance initialized to CSS color #48D1CC
* <span class="colorSwath" style="background: #48D1CC;"></span>
*
* @constant
* @type {Color}
*/
Color.MEDIUMTURQUOISE = freezeObject(Color.fromCssColorString('#48D1CC'));
/**
* An immutable Color instance initialized to CSS color #C71585
* <span class="colorSwath" style="background: #C71585;"></span>
*
* @constant
* @type {Color}
*/
Color.MEDIUMVIOLETRED = freezeObject(Color.fromCssColorString('#C71585'));
/**
* An immutable Color instance initialized to CSS color #191970
* <span class="colorSwath" style="background: #191970;"></span>
*
* @constant
* @type {Color}
*/
Color.MIDNIGHTBLUE = freezeObject(Color.fromCssColorString('#191970'));
/**
* An immutable Color instance initialized to CSS color #F5FFFA
* <span class="colorSwath" style="background: #F5FFFA;"></span>
*
* @constant
* @type {Color}
*/
Color.MINTCREAM = freezeObject(Color.fromCssColorString('#F5FFFA'));
/**
* An immutable Color instance initialized to CSS color #FFE4E1
* <span class="colorSwath" style="background: #FFE4E1;"></span>
*
* @constant
* @type {Color}
*/
Color.MISTYROSE = freezeObject(Color.fromCssColorString('#FFE4E1'));
/**
* An immutable Color instance initialized to CSS color #FFE4B5
* <span class="colorSwath" style="background: #FFE4B5;"></span>
*
* @constant
* @type {Color}
*/
Color.MOCCASIN = freezeObject(Color.fromCssColorString('#FFE4B5'));
/**
* An immutable Color instance initialized to CSS color #FFDEAD
* <span class="colorSwath" style="background: #FFDEAD;"></span>
*
* @constant
* @type {Color}
*/
Color.NAVAJOWHITE = freezeObject(Color.fromCssColorString('#FFDEAD'));
/**
* An immutable Color instance initialized to CSS color #000080
* <span class="colorSwath" style="background: #000080;"></span>
*
* @constant
* @type {Color}
*/
Color.NAVY = freezeObject(Color.fromCssColorString('#000080'));
/**
* An immutable Color instance initialized to CSS color #FDF5E6
* <span class="colorSwath" style="background: #FDF5E6;"></span>
*
* @constant
* @type {Color}
*/
Color.OLDLACE = freezeObject(Color.fromCssColorString('#FDF5E6'));
/**
* An immutable Color instance initialized to CSS color #808000
* <span class="colorSwath" style="background: #808000;"></span>
*
* @constant
* @type {Color}
*/
Color.OLIVE = freezeObject(Color.fromCssColorString('#808000'));
/**
* An immutable Color instance initialized to CSS color #6B8E23
* <span class="colorSwath" style="background: #6B8E23;"></span>
*
* @constant
* @type {Color}
*/
Color.OLIVEDRAB = freezeObject(Color.fromCssColorString('#6B8E23'));
/**
* An immutable Color instance initialized to CSS color #FFA500
* <span class="colorSwath" style="background: #FFA500;"></span>
*
* @constant
* @type {Color}
*/
Color.ORANGE = freezeObject(Color.fromCssColorString('#FFA500'));
/**
* An immutable Color instance initialized to CSS color #FF4500
* <span class="colorSwath" style="background: #FF4500;"></span>
*
* @constant
* @type {Color}
*/
Color.ORANGERED = freezeObject(Color.fromCssColorString('#FF4500'));
/**
* An immutable Color instance initialized to CSS color #DA70D6
* <span class="colorSwath" style="background: #DA70D6;"></span>
*
* @constant
* @type {Color}
*/
Color.ORCHID = freezeObject(Color.fromCssColorString('#DA70D6'));
/**
* An immutable Color instance initialized to CSS color #EEE8AA
* <span class="colorSwath" style="background: #EEE8AA;"></span>
*
* @constant
* @type {Color}
*/
Color.PALEGOLDENROD = freezeObject(Color.fromCssColorString('#EEE8AA'));
/**
* An immutable Color instance initialized to CSS color #98FB98
* <span class="colorSwath" style="background: #98FB98;"></span>
*
* @constant
* @type {Color}
*/
Color.PALEGREEN = freezeObject(Color.fromCssColorString('#98FB98'));
/**
* An immutable Color instance initialized to CSS color #AFEEEE
* <span class="colorSwath" style="background: #AFEEEE;"></span>
*
* @constant
* @type {Color}
*/
Color.PALETURQUOISE = freezeObject(Color.fromCssColorString('#AFEEEE'));
/**
* An immutable Color instance initialized to CSS color #DB7093
* <span class="colorSwath" style="background: #DB7093;"></span>
*
* @constant
* @type {Color}
*/
Color.PALEVIOLETRED = freezeObject(Color.fromCssColorString('#DB7093'));
/**
* An immutable Color instance initialized to CSS color #FFEFD5
* <span class="colorSwath" style="background: #FFEFD5;"></span>
*
* @constant
* @type {Color}
*/
Color.PAPAYAWHIP = freezeObject(Color.fromCssColorString('#FFEFD5'));
/**
* An immutable Color instance initialized to CSS color #FFDAB9
* <span class="colorSwath" style="background: #FFDAB9;"></span>
*
* @constant
* @type {Color}
*/
Color.PEACHPUFF = freezeObject(Color.fromCssColorString('#FFDAB9'));
/**
* An immutable Color instance initialized to CSS color #CD853F
* <span class="colorSwath" style="background: #CD853F;"></span>
*
* @constant
* @type {Color}
*/
Color.PERU = freezeObject(Color.fromCssColorString('#CD853F'));
/**
* An immutable Color instance initialized to CSS color #FFC0CB
* <span class="colorSwath" style="background: #FFC0CB;"></span>
*
* @constant
* @type {Color}
*/
Color.PINK = freezeObject(Color.fromCssColorString('#FFC0CB'));
/**
* An immutable Color instance initialized to CSS color #DDA0DD
* <span class="colorSwath" style="background: #DDA0DD;"></span>
*
* @constant
* @type {Color}
*/
Color.PLUM = freezeObject(Color.fromCssColorString('#DDA0DD'));
/**
* An immutable Color instance initialized to CSS color #B0E0E6
* <span class="colorSwath" style="background: #B0E0E6;"></span>
*
* @constant
* @type {Color}
*/
Color.POWDERBLUE = freezeObject(Color.fromCssColorString('#B0E0E6'));
/**
* An immutable Color instance initialized to CSS color #800080
* <span class="colorSwath" style="background: #800080;"></span>
*
* @constant
* @type {Color}
*/
Color.PURPLE = freezeObject(Color.fromCssColorString('#800080'));
/**
* An immutable Color instance initialized to CSS color #FF0000
* <span class="colorSwath" style="background: #FF0000;"></span>
*
* @constant
* @type {Color}
*/
Color.RED = freezeObject(Color.fromCssColorString('#FF0000'));
/**
* An immutable Color instance initialized to CSS color #BC8F8F
* <span class="colorSwath" style="background: #BC8F8F;"></span>
*
* @constant
* @type {Color}
*/
Color.ROSYBROWN = freezeObject(Color.fromCssColorString('#BC8F8F'));
/**
* An immutable Color instance initialized to CSS color #4169E1
* <span class="colorSwath" style="background: #4169E1;"></span>
*
* @constant
* @type {Color}
*/
Color.ROYALBLUE = freezeObject(Color.fromCssColorString('#4169E1'));
/**
* An immutable Color instance initialized to CSS color #8B4513
* <span class="colorSwath" style="background: #8B4513;"></span>
*
* @constant
* @type {Color}
*/
Color.SADDLEBROWN = freezeObject(Color.fromCssColorString('#8B4513'));
/**
* An immutable Color instance initialized to CSS color #FA8072
* <span class="colorSwath" style="background: #FA8072;"></span>
*
* @constant
* @type {Color}
*/
Color.SALMON = freezeObject(Color.fromCssColorString('#FA8072'));
/**
* An immutable Color instance initialized to CSS color #F4A460
* <span class="colorSwath" style="background: #F4A460;"></span>
*
* @constant
* @type {Color}
*/
Color.SANDYBROWN = freezeObject(Color.fromCssColorString('#F4A460'));
/**
* An immutable Color instance initialized to CSS color #2E8B57
* <span class="colorSwath" style="background: #2E8B57;"></span>
*
* @constant
* @type {Color}
*/
Color.SEAGREEN = freezeObject(Color.fromCssColorString('#2E8B57'));
/**
* An immutable Color instance initialized to CSS color #FFF5EE
* <span class="colorSwath" style="background: #FFF5EE;"></span>
*
* @constant
* @type {Color}
*/
Color.SEASHELL = freezeObject(Color.fromCssColorString('#FFF5EE'));
/**
* An immutable Color instance initialized to CSS color #A0522D
* <span class="colorSwath" style="background: #A0522D;"></span>
*
* @constant
* @type {Color}
*/
Color.SIENNA = freezeObject(Color.fromCssColorString('#A0522D'));
/**
* An immutable Color instance initialized to CSS color #C0C0C0
* <span class="colorSwath" style="background: #C0C0C0;"></span>
*
* @constant
* @type {Color}
*/
Color.SILVER = freezeObject(Color.fromCssColorString('#C0C0C0'));
/**
* An immutable Color instance initialized to CSS color #87CEEB
* <span class="colorSwath" style="background: #87CEEB;"></span>
*
* @constant
* @type {Color}
*/
Color.SKYBLUE = freezeObject(Color.fromCssColorString('#87CEEB'));
/**
* An immutable Color instance initialized to CSS color #6A5ACD
* <span class="colorSwath" style="background: #6A5ACD;"></span>
*
* @constant
* @type {Color}
*/
Color.SLATEBLUE = freezeObject(Color.fromCssColorString('#6A5ACD'));
/**
* An immutable Color instance initialized to CSS color #708090
* <span class="colorSwath" style="background: #708090;"></span>
*
* @constant
* @type {Color}
*/
Color.SLATEGRAY = freezeObject(Color.fromCssColorString('#708090'));
/**
* An immutable Color instance initialized to CSS color #708090
* <span class="colorSwath" style="background: #708090;"></span>
*
* @constant
* @type {Color}
*/
Color.SLATEGREY = Color.SLATEGRAY;
/**
* An immutable Color instance initialized to CSS color #FFFAFA
* <span class="colorSwath" style="background: #FFFAFA;"></span>
*
* @constant
* @type {Color}
*/
Color.SNOW = freezeObject(Color.fromCssColorString('#FFFAFA'));
/**
* An immutable Color instance initialized to CSS color #00FF7F
* <span class="colorSwath" style="background: #00FF7F;"></span>
*
* @constant
* @type {Color}
*/
Color.SPRINGGREEN = freezeObject(Color.fromCssColorString('#00FF7F'));
/**
* An immutable Color instance initialized to CSS color #4682B4
* <span class="colorSwath" style="background: #4682B4;"></span>
*
* @constant
* @type {Color}
*/
Color.STEELBLUE = freezeObject(Color.fromCssColorString('#4682B4'));
/**
* An immutable Color instance initialized to CSS color #D2B48C
* <span class="colorSwath" style="background: #D2B48C;"></span>
*
* @constant
* @type {Color}
*/
Color.TAN = freezeObject(Color.fromCssColorString('#D2B48C'));
/**
* An immutable Color instance initialized to CSS color #008080
* <span class="colorSwath" style="background: #008080;"></span>
*
* @constant
* @type {Color}
*/
Color.TEAL = freezeObject(Color.fromCssColorString('#008080'));
/**
* An immutable Color instance initialized to CSS color #D8BFD8
* <span class="colorSwath" style="background: #D8BFD8;"></span>
*
* @constant
* @type {Color}
*/
Color.THISTLE = freezeObject(Color.fromCssColorString('#D8BFD8'));
/**
* An immutable Color instance initialized to CSS color #FF6347
* <span class="colorSwath" style="background: #FF6347;"></span>
*
* @constant
* @type {Color}
*/
Color.TOMATO = freezeObject(Color.fromCssColorString('#FF6347'));
/**
* An immutable Color instance initialized to CSS color #40E0D0
* <span class="colorSwath" style="background: #40E0D0;"></span>
*
* @constant
* @type {Color}
*/
Color.TURQUOISE = freezeObject(Color.fromCssColorString('#40E0D0'));
/**
* An immutable Color instance initialized to CSS color #EE82EE
* <span class="colorSwath" style="background: #EE82EE;"></span>
*
* @constant
* @type {Color}
*/
Color.VIOLET = freezeObject(Color.fromCssColorString('#EE82EE'));
/**
* An immutable Color instance initialized to CSS color #F5DEB3
* <span class="colorSwath" style="background: #F5DEB3;"></span>
*
* @constant
* @type {Color}
*/
Color.WHEAT = freezeObject(Color.fromCssColorString('#F5DEB3'));
/**
* An immutable Color instance initialized to CSS color #FFFFFF
* <span class="colorSwath" style="background: #FFFFFF;"></span>
*
* @constant
* @type {Color}
*/
Color.WHITE = freezeObject(Color.fromCssColorString('#FFFFFF'));
/**
* An immutable Color instance initialized to CSS color #F5F5F5
* <span class="colorSwath" style="background: #F5F5F5;"></span>
*
* @constant
* @type {Color}
*/
Color.WHITESMOKE = freezeObject(Color.fromCssColorString('#F5F5F5'));
/**
* An immutable Color instance initialized to CSS color #FFFF00
* <span class="colorSwath" style="background: #FFFF00;"></span>
*
* @constant
* @type {Color}
*/
Color.YELLOW = freezeObject(Color.fromCssColorString('#FFFF00'));
/**
* An immutable Color instance initialized to CSS color #9ACD32
* <span class="colorSwath" style="background: #9ACD32;"></span>
*
* @constant
* @type {Color}
*/
Color.YELLOWGREEN = freezeObject(Color.fromCssColorString('#9ACD32'));
return Color;
});
/*global define*/
define('Core/Cartesian2',[
'./defaultValue',
'./defined',
'./DeveloperError',
'./freezeObject'
], function(
defaultValue,
defined,
DeveloperError,
freezeObject) {
"use strict";
/**
* A 2D Cartesian point.
* @alias Cartesian2
* @constructor
*
* @param {Number} [x=0.0] The X component.
* @param {Number} [y=0.0] The Y component.
*
* @see Packable
* @see Cartesian3
* @see Cartesian4
*/
var Cartesian2 = function(x, y) {
/**
* The Y component.
* @type {Number}
* @default 0.0
*/
this.x = defaultValue(x, 0.0);
/**
* The X component.
* @type {Number}
* @default 0.0
*/
this.y = defaultValue(y, 0.0);
};
/**
* Creates a Cartesian2 instance from x and y coordinates.
* @memberof Cartesian2
*
* @param {Number} x The x coordinate.
* @param {Number} y The y coordinate.
* @param {Cartesian2} [result] The object onto which to store the result.
* @returns {Cartesian2} The modified result parameter or a new Cartesian2 instance if one was not provided.
*/
Cartesian2.fromElements = function(x, y, result) {
if (!defined(result)) {
return new Cartesian2(x, y);
}
result.x = x;
result.y = y;
return result;
};
/**
* Duplicates a Cartesian2 instance.
* @memberof Cartesian2
*
* @param {Cartesian2} cartesian The Cartesian to duplicate.
* @param {Cartesian2} [result] The object onto which to store the result.
* @returns {Cartesian2} The modified result parameter or a new Cartesian2 instance if one was not provided. (Returns undefined if cartesian is undefined)
*/
Cartesian2.clone = function(cartesian, result) {
if (!defined(cartesian)) {
return undefined;
}
if (!defined(result)) {
return new Cartesian2(cartesian.x, cartesian.y);
}
result.x = cartesian.x;
result.y = cartesian.y;
return result;
};
/**
* Creates a Cartesian2 instance from an existing Cartesian3. This simply takes the
* x and y properties of the Cartesian3 and drops z.
* @memberof Cartesian2
* @function
*
* @param {Cartesian3} cartesian The Cartesian3 instance to create a Cartesian2 instance from.
* @param {Cartesian2} [result] The object onto which to store the result.
* @returns {Cartesian2} The modified result parameter or a new Cartesian2 instance if one was not provided.
*
* @exception {DeveloperError} cartesian is required.
*/
Cartesian2.fromCartesian3 = Cartesian2.clone;
/**
* Creates a Cartesian2 instance from an existing Cartesian4. This simply takes the
* x and y properties of the Cartesian4 and drops z and w.
* @function
*
* @param {Cartesian4} cartesian The Cartesian4 instance to create a Cartesian2 instance from.
* @param {Cartesian2} [result] The object onto which to store the result.
* @returns {Cartesian2} The modified result parameter or a new Cartesian2 instance if one was not provided.
*
* @exception {DeveloperError} cartesian is required.
*/
Cartesian2.fromCartesian4 = Cartesian2.clone;
/**
* The number of elements used to pack the object into an array.
* @Type {Number}
*/
Cartesian2.packedLength = 2;
/**
* Stores the provided instance into the provided array.
* @memberof Cartesian2
*
* @param {Cartesian2} value The value to pack.
* @param {Array} array The array to pack into.
* @param {Number} [startingIndex=0] The index into the array at which to start packing the elements.
*
* @exception {DeveloperError} value is required.
* @exception {DeveloperError} array is required.
*/
Cartesian2.pack = function(value, array, startingIndex) {
if (!defined(value)) {
throw new DeveloperError('value is required');
}
if (!defined(array)) {
throw new DeveloperError('array is required');
}
startingIndex = defaultValue(startingIndex, 0);
array[startingIndex++] = value.x;
array[startingIndex] = value.y;
};
/**
* Retrieves an instance from a packed array.
* @memberof Cartesian2
*
* @param {Array} array The packed array.
* @param {Number} [startingIndex=0] The starting index of the element to be unpacked.
* @param {Cartesian2} [result] The object into which to store the result.
*
* @exception {DeveloperError} array is required.
*/
Cartesian2.unpack = function(array, startingIndex, result) {
if (!defined(array)) {
throw new DeveloperError('array is required');
}
startingIndex = defaultValue(startingIndex, 0);
if (!defined(result)) {
result = new Cartesian2();
}
result.x = array[startingIndex++];
result.y = array[startingIndex];
return result;
};
/**
* Creates a Cartesian2 from two consecutive elements in an array.
* @memberof Cartesian2
*
* @param {Array} array The array whose two consecutive elements correspond to the x and y components, respectively.
* @param {Number} [startingIndex=0] The offset into the array of the first element, which corresponds to the x component.
* @param {Cartesian2} [result] The object onto which to store the result.
*
* @returns {Cartesian2} The modified result parameter or a new Cartesian2 instance if one was not provided.
*
* @exception {DeveloperError} array is required.
*
* @example
* // Create a Cartesian2 with (1.0, 2.0)
* var v = [1.0, 2.0];
* var p = Cartesian2.fromArray(v);
*
* // Create a Cartesian2 with (1.0, 2.0) using an offset into an array
* var v2 = [0.0, 0.0, 1.0, 2.0];
* var p2 = Cartesian2.fromArray(v2, 2);
*/
Cartesian2.fromArray = Cartesian2.unpack;
/**
* Computes the value of the maximum component for the supplied Cartesian.
* @memberof Cartesian2
*
* @param {Cartesian2} The cartesian to use.
* @returns {Number} The value of the maximum component.
*
* @exception {DeveloperError} cartesian is required.
*/
Cartesian2.getMaximumComponent = function(cartesian) {
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required');
}
return Math.max(cartesian.x, cartesian.y);
};
/**
* Computes the value of the minimum component for the supplied Cartesian.
* @memberof Cartesian2
*
* @param {Cartesian2} The cartesian to use.
* @returns {Number} The value of the minimum component.
*
* @exception {DeveloperError} cartesian is required.
*/
Cartesian2.getMinimumComponent = function(cartesian) {
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required');
}
return Math.min(cartesian.x, cartesian.y);
};
/**
* Computes the provided Cartesian's squared magnitude.
* @memberof Cartesian2
*
* @param {Cartesian2} cartesian The Cartesian instance whose squared magnitude is to be computed.
* @returns {Number} The squared magnitude.
*
* @exception {DeveloperError} cartesian is required.
*/
Cartesian2.magnitudeSquared = function(cartesian) {
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required');
}
return cartesian.x * cartesian.x + cartesian.y * cartesian.y;
};
/**
* Computes the Cartesian's magnitude (length).
* @memberof Cartesian2
*
* @param {Cartesian2} cartesian The Cartesian instance whose magnitude is to be computed.
* @returns {Number} The magnitude.
*
* @exception {DeveloperError} cartesian is required.
*/
Cartesian2.magnitude = function(cartesian) {
return Math.sqrt(Cartesian2.magnitudeSquared(cartesian));
};
var distanceScratch = new Cartesian2();
/**
* Computes the distance between two points
* @memberof Cartesian2
*
* @param {Cartesian2} left The first point to compute the distance from.
* @param {Cartesian2} right The second point to compute the distance to.
*
* @returns {Number} The distance between two points.
*
* @exception {DeveloperError} left and right are required.
*
* @example
* // Returns 1.0
* var d = Cartesian2.distance(new Cartesian2(1.0, 0.0), new Cartesian2(2.0, 0.0));
*/
Cartesian2.distance = function(left, right) {
if (!defined(left) || !defined(right)) {
throw new DeveloperError('left and right are required.');
}
Cartesian2.subtract(left, right, distanceScratch);
return Cartesian2.magnitude(distanceScratch);
};
/**
* Computes the normalized form of the supplied Cartesian.
* @memberof Cartesian2
*
* @param {Cartesian2} cartesian The Cartesian to be normalized.
* @param {Cartesian2} [result] The object onto which to store the result.
* @returns {Cartesian2} The modified result parameter or a new Cartesian2 instance if one was not provided.
*
* @exception {DeveloperError} cartesian is required.
*/
Cartesian2.normalize = function(cartesian, result) {
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required');
}
var magnitude = Cartesian2.magnitude(cartesian);
if (!defined(result)) {
return new Cartesian2(cartesian.x / magnitude, cartesian.y / magnitude);
}
result.x = cartesian.x / magnitude;
result.y = cartesian.y / magnitude;
return result;
};
/**
* Computes the dot (scalar) product of two Cartesians.
* @memberof Cartesian2
*
* @param {Cartesian2} left The first Cartesian.
* @param {Cartesian2} right The second Cartesian.
* @returns {Number} The dot product.
*
* @exception {DeveloperError} left is required.
* @exception {DeveloperError} right is required.
*/
Cartesian2.dot = function(left, right) {
if (!defined(left)) {
throw new DeveloperError('left is required');
}
if (!defined(right)) {
throw new DeveloperError('right is required');
}
return left.x * right.x + left.y * right.y;
};
/**
* Computes the componentwise product of two Cartesians.
* @memberof Cartesian2
*
* @param {Cartesian2} left The first Cartesian.
* @param {Cartesian2} right The second Cartesian.
* @param {Cartesian2} [result] The object onto which to store the result.
* @returns {Cartesian2} The modified result parameter or a new Cartesian2 instance if one was not provided.
*
* @exception {DeveloperError} left is required.
* @exception {DeveloperError} right is required.
*/
Cartesian2.multiplyComponents = function(left, right, result) {
if (!defined(left)) {
throw new DeveloperError('left is required');
}
if (!defined(right)) {
throw new DeveloperError('right is required');
}
if (!defined(result)) {
return new Cartesian2(left.x * right.x, left.y * right.y);
}
result.x = left.x * right.x;
result.y = left.y * right.y;
return result;
};
/**
* Computes the componentwise sum of two Cartesians.
* @memberof Cartesian2
*
* @param {Cartesian2} left The first Cartesian.
* @param {Cartesian2} right The second Cartesian.
* @param {Cartesian2} [result] The object onto which to store the result.
* @returns {Cartesian2} The modified result parameter or a new Cartesian2 instance if one was not provided.
*
* @exception {DeveloperError} left is required.
* @exception {DeveloperError} right is required.
*/
Cartesian2.add = function(left, right, result) {
if (!defined(left)) {
throw new DeveloperError('left is required');
}
if (!defined(right)) {
throw new DeveloperError('right is required');
}
if (!defined(result)) {
return new Cartesian2(left.x + right.x, left.y + right.y);
}
result.x = left.x + right.x;
result.y = left.y + right.y;
return result;
};
/**
* Computes the componentwise difference of two Cartesians.
* @memberof Cartesian2
*
* @param {Cartesian2} left The first Cartesian.
* @param {Cartesian2} right The second Cartesian.
* @param {Cartesian2} [result] The object onto which to store the result.
* @returns {Cartesian2} The modified result parameter or a new Cartesian2 instance if one was not provided.
*
* @exception {DeveloperError} left is required.
* @exception {DeveloperError} right is required.
*/
Cartesian2.subtract = function(left, right, result) {
if (!defined(left)) {
throw new DeveloperError('left is required');
}
if (!defined(right)) {
throw new DeveloperError('right is required');
}
if (!defined(result)) {
return new Cartesian2(left.x - right.x, left.y - right.y);
}
result.x = left.x - right.x;
result.y = left.y - right.y;
return result;
};
/**
* Multiplies the provided Cartesian componentwise by the provided scalar.
* @memberof Cartesian2
*
* @param {Cartesian2} cartesian The Cartesian to be scaled.
* @param {Number} scalar The scalar to multiply with.
* @param {Cartesian2} [result] The object onto which to store the result.
* @returns {Cartesian2} The modified result parameter or a new Cartesian2 instance if one was not provided.
*
* @exception {DeveloperError} cartesian is required.
* @exception {DeveloperError} scalar is required and must be a number.
*/
Cartesian2.multiplyByScalar = function(cartesian, scalar, result) {
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required');
}
if (typeof scalar !== 'number') {
throw new DeveloperError('scalar is required and must be a number.');
}
if (!defined(result)) {
return new Cartesian2(cartesian.x * scalar, cartesian.y * scalar);
}
result.x = cartesian.x * scalar;
result.y = cartesian.y * scalar;
return result;
};
/**
* Divides the provided Cartesian componentwise by the provided scalar.
* @memberof Cartesian2
*
* @param {Cartesian2} cartesian The Cartesian to be divided.
* @param {Number} scalar The scalar to divide by.
* @param {Cartesian2} [result] The object onto which to store the result.
* @returns {Cartesian2} The modified result parameter or a new Cartesian2 instance if one was not provided.
*
* @exception {DeveloperError} cartesian is required.
* @exception {DeveloperError} scalar is required and must be a number.
*/
Cartesian2.divideByScalar = function(cartesian, scalar, result) {
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required');
}
if (typeof scalar !== 'number') {
throw new DeveloperError('scalar is required and must be a number.');
}
if (!defined(result)) {
return new Cartesian2(cartesian.x / scalar, cartesian.y / scalar);
}
result.x = cartesian.x / scalar;
result.y = cartesian.y / scalar;
return result;
};
/**
* Negates the provided Cartesian.
* @memberof Cartesian2
*
* @param {Cartesian2} cartesian The Cartesian to be negated.
* @param {Cartesian2} [result] The object onto which to store the result.
* @returns {Cartesian2} The modified result parameter or a new Cartesian2 instance if one was not provided.
*
* @exception {DeveloperError} cartesian is required.
*/
Cartesian2.negate = function(cartesian, result) {
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required');
}
if (!defined(result)) {
return new Cartesian2(-cartesian.x, -cartesian.y);
}
result.x = -cartesian.x;
result.y = -cartesian.y;
return result;
};
/**
* Computes the absolute value of the provided Cartesian.
* @memberof Cartesian2
*
* @param {Cartesian2} cartesian The Cartesian whose absolute value is to be computed.
* @param {Cartesian2} [result] The object onto which to store the result.
* @returns {Cartesian2} The modified result parameter or a new Cartesian2 instance if one was not provided.
*
* @exception {DeveloperError} cartesian is required.
*/
Cartesian2.abs = function(cartesian, result) {
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required');
}
if (!defined(result)) {
return new Cartesian2(Math.abs(cartesian.x), Math.abs(cartesian.y));
}
result.x = Math.abs(cartesian.x);
result.y = Math.abs(cartesian.y);
return result;
};
var lerpScratch = new Cartesian2();
/**
* Computes the linear interpolation or extrapolation at t using the provided cartesians.
* @memberof Cartesian2
*
* @param start The value corresponding to t at 0.0.
* @param end The value corresponding to t at 1.0.
* @param t The point along t at which to interpolate.
* @param {Cartesian2} [result] The object onto which to store the result.
* @returns {Cartesian2} The modified result parameter or a new Cartesian2 instance if one was not provided.
*
* @exception {DeveloperError} start is required.
* @exception {DeveloperError} end is required.
* @exception {DeveloperError} t is required and must be a number.
*/
Cartesian2.lerp = function(start, end, t, result) {
if (!defined(start)) {
throw new DeveloperError('start is required.');
}
if (!defined(end)) {
throw new DeveloperError('end is required.');
}
if (typeof t !== 'number') {
throw new DeveloperError('t is required and must be a number.');
}
Cartesian2.multiplyByScalar(end, t, lerpScratch);
result = Cartesian2.multiplyByScalar(start, 1.0 - t, result);
return Cartesian2.add(lerpScratch, result, result);
};
var angleBetweenScratch = new Cartesian2();
var angleBetweenScratch2 = new Cartesian2();
/**
* Returns the angle, in radians, between the provided Cartesians.
* @memberof Cartesian2
*
* @param {Cartesian2} left The first Cartesian.
* @param {Cartesian2} right The second Cartesian.
* @returns {Number} The angle between the Cartesians.
*
* @exception {DeveloperError} left is required.
* @exception {DeveloperError} right is required.
*/
Cartesian2.angleBetween = function(left, right) {
if (!defined(left)) {
throw new DeveloperError('left is required');
}
if (!defined(right)) {
throw new DeveloperError('right is required');
}
Cartesian2.normalize(left, angleBetweenScratch);
Cartesian2.normalize(right, angleBetweenScratch2);
return Math.acos(Cartesian2.dot(angleBetweenScratch, angleBetweenScratch2));
};
var mostOrthogonalAxisScratch = new Cartesian2();
/**
* Returns the axis that is most orthogonal to the provided Cartesian.
* @memberof Cartesian2
*
* @param {Cartesian2} cartesian The Cartesian on which to find the most orthogonal axis.
* @param {Cartesian2} [result] The object onto which to store the result.
* @returns {Cartesian2} The most orthogonal axis.
*
* @exception {DeveloperError} cartesian is required.
*/
Cartesian2.mostOrthogonalAxis = function(cartesian, result) {
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required.');
}
var f = Cartesian2.normalize(cartesian, mostOrthogonalAxisScratch);
Cartesian2.abs(f, f);
if (f.x <= f.y) {
result = Cartesian2.clone(Cartesian2.UNIT_X, result);
} else {
result = Cartesian2.clone(Cartesian2.UNIT_Y, result);
}
return result;
};
/**
* Compares the provided Cartesians componentwise and returns
* <code>true</code> if they are equal, <code>false</code> otherwise.
* @memberof Cartesian2
*
* @param {Cartesian2} [left] The first Cartesian.
* @param {Cartesian2} [right] The second Cartesian.
* @returns {Boolean} <code>true</code> if left and right are equal, <code>false</code> otherwise.
*/
Cartesian2.equals = function(left, right) {
return (left === right) ||
((defined(left)) &&
(defined(right)) &&
(left.x === right.x) &&
(left.y === right.y));
};
/**
* Compares the provided Cartesians componentwise and returns
* <code>true</code> if they are within the provided epsilon,
* <code>false</code> otherwise.
* @memberof Cartesian2
*
* @param {Cartesian2} [left] The first Cartesian.
* @param {Cartesian2} [right] The second Cartesian.
* @param {Number} epsilon The epsilon to use for equality testing.
* @returns {Boolean} <code>true</code> if left and right are within the provided epsilon, <code>false</code> otherwise.
*
* @exception {DeveloperError} epsilon is required and must be a number.
*/
Cartesian2.equalsEpsilon = function(left, right, epsilon) {
if (typeof epsilon !== 'number') {
throw new DeveloperError('epsilon is required and must be a number.');
}
return (left === right) ||
((defined(left)) &&
(defined(right)) &&
(Math.abs(left.x - right.x) <= epsilon) &&
(Math.abs(left.y - right.y) <= epsilon));
};
/**
* An immutable Cartesian2 instance initialized to (0.0, 0.0).
* @memberof Cartesian2
*/
Cartesian2.ZERO = freezeObject(new Cartesian2(0.0, 0.0));
/**
* An immutable Cartesian2 instance initialized to (1.0, 0.0).
* @memberof Cartesian2
*/
Cartesian2.UNIT_X = freezeObject(new Cartesian2(1.0, 0.0));
/**
* An immutable Cartesian2 instance initialized to (0.0, 1.0).
* @memberof Cartesian2
*/
Cartesian2.UNIT_Y = freezeObject(new Cartesian2(0.0, 1.0));
/**
* Duplicates this Cartesian2 instance.
* @memberof Cartesian2
*
* @param {Cartesian2} [result] The object onto which to store the result.
* @returns {Cartesian2} The modified result parameter or a new Cartesian2 instance if one was not provided.
*/
Cartesian2.prototype.clone = function(result) {
return Cartesian2.clone(this, result);
};
/**
* Creates a string representing this Cartesian in the format '(x, y)'.
* @memberof Cartesian2
*
* @returns {String} A string representing the provided Cartesian in the format '(x, y)'.
*/
Cartesian2.prototype.toString = function() {
return '(' + this.x + ', ' + this.y + ')';
};
return Cartesian2;
});
/*global define*/
define('Core/barycentricCoordinates',[
'./Cartesian2',
'./Cartesian3',
'./defined',
'./DeveloperError'
], function(
Cartesian2,
Cartesian3,
defined,
DeveloperError) {
"use strict";
var scratchCartesian1 = new Cartesian3();
var scratchCartesian2 = new Cartesian3();
var scratchCartesian3 = new Cartesian3();
/**
* Computes the barycentric coordinates for a point with respect to a triangle.
*
* @exports pointInsideTriangle
*
* @param {Cartesian2|Cartesian3} point The point to test.
* @param {Cartesian2|Cartesian3} p0 The first point of the triangle, corresponding to the barycentric x-axis.
* @param {Cartesian2|Cartesian3} p1 The second point of the triangle, corresponding to the barycentric y-axis.
* @param {Cartesian2|Cartesian3} p2 The third point of the triangle, corresponding to the barycentric z-axis.
* @param {Cartesian3} [result] The object onto which to store the result.
*
* @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided.
*
* @exception {DeveloperError} point, p0, p1, and p2 are required.
*
* @example
* // Returns Cartesian3.UNIT_X
* var p = new Cartesian3(-1.0, 0.0, 0.0);
* var b = barycentricCoordinates(p,
* new Cartesian3(-1.0, 0.0, 0.0),
* new Cartesian3( 1.0, 0.0, 0.0),
* new Cartesian3( 0.0, 1.0, 1.0));
*/
var barycentricCoordinates = function(point, p0, p1, p2, result) {
if (!defined(point) || !defined(p0) || !defined(p1) || !defined(p2)) {
throw new DeveloperError('point, p0, p1, and p2 are required.');
}
if (!defined(result)) {
result = new Cartesian3();
}
// Implementation based on http://www.blackpawn.com/texts/pointinpoly/default.html.
var v0, v1, v2;
var dot00, dot01, dot02, dot11, dot12;
if(!defined(p0.z)) {
v0 = Cartesian2.subtract(p1, p0, scratchCartesian1);
v1 = Cartesian2.subtract(p2, p0, scratchCartesian2);
v2 = Cartesian2.subtract(point, p0, scratchCartesian3);
dot00 = Cartesian2.dot(v0, v0);
dot01 = Cartesian2.dot(v0, v1);
dot02 = Cartesian2.dot(v0, v2);
dot11 = Cartesian2.dot(v1, v1);
dot12 = Cartesian2.dot(v1, v2);
} else {
v0 = Cartesian3.subtract(p1, p0, scratchCartesian1);
v1 = Cartesian3.subtract(p2, p0, scratchCartesian2);
v2 = Cartesian3.subtract(point, p0, scratchCartesian3);
dot00 = Cartesian3.dot(v0, v0);
dot01 = Cartesian3.dot(v0, v1);
dot02 = Cartesian3.dot(v0, v2);
dot11 = Cartesian3.dot(v1, v1);
dot12 = Cartesian3.dot(v1, v2);
}
var q = 1.0 / (dot00 * dot11 - dot01 * dot01);
result.y = (dot11 * dot02 - dot01 * dot12) * q;
result.z = (dot00 * dot12 - dot01 * dot02) * q;
result.x = 1.0 - result.y - result.z;
return result;
};
return barycentricCoordinates;
});
/*global define*/
define('Core/EncodedCartesian3',[
'./Cartesian3',
'./defined',
'./DeveloperError'
], function(
Cartesian3,
defined,
DeveloperError) {
"use strict";
/**
* A fixed-point encoding of a {@link Cartesian3} with 64-bit floating-point components, as two {@link Cartesian3}
* values that, when converted to 32-bit floating-point and added, approximate the original input.
* <p>
* This is used to encode positions in vertex buffers for rendering without jittering artifacts
* as described in <a href="http://blogs.agi.com/insight3d/index.php/2008/09/03/precisions-precisions/">Precisions, Precisions</a>.
* </p>
*
* @alias EncodedCartesian3
* @constructor
*
* @see czm_modelViewRelativeToEye
* @see czm_modelViewProjectionRelativeToEye
*/
var EncodedCartesian3 = function() {
/**
* The high bits for each component. Bits 0 to 22 store the whole value. Bits 23 to 31 are not used.
* <p>
* The default is {@link Cartesian3.ZERO}.
* </p>
*
* @type {Cartesian3}
* @default {@link Cartesian3.ZERO}
*/
this.high = Cartesian3.clone(Cartesian3.ZERO);
/**
* The low bits for each component. Bits 7 to 22 store the whole value, and bits 0 to 6 store the fraction. Bits 23 to 31 are not used.
* <p>
* The default is {@link Cartesian3.ZERO}.
* </p>
*
* @type {Cartesian3}
* @default {@link Cartesian3.ZERO}
*/
this.low = Cartesian3.clone(Cartesian3.ZERO);
};
/**
* Encodes a 64-bit floating-point value as two floating-point values that, when converted to
* 32-bit floating-point and added, approximate the original input. The returned object
* has <code>high</code> and <code>low</code> properties for the high and low bits, respectively.
* <p>
* The fixed-point encoding follows <a href="http://blogs.agi.com/insight3d/index.php/2008/09/03/precisions-precisions/">Precisions, Precisions</a>.
* </p>
* @memberof EncodedCartesian3
*
* @param {Number} value The floating-point value to encode.
* @param {Object} [result] The object onto which to store the result.
*
* @returns {Object} The modified result parameter or a new instance if one was not provided.
*
* @exception {DeveloperError} value is required.
*
* @example
* var value = 1234567.1234567;
* var splitValue = EncodedCartesian3.encode(value);
*/
EncodedCartesian3.encode = function(value, result) {
if (!defined(value)) {
throw new DeveloperError('value is required');
}
if (!defined(result)) {
result = {
high : 0.0,
low : 0.0
};
}
var doubleHigh;
if (value >= 0.0) {
doubleHigh = Math.floor(value / 65536.0) * 65536.0;
result.high = doubleHigh;
result.low = value - doubleHigh;
} else {
doubleHigh = Math.floor(-value / 65536.0) * 65536.0;
result.high = -doubleHigh;
result.low = value + doubleHigh;
}
return result;
};
var scratchEncode = {
high : 0.0,
low : 0.0
};
/**
* Encodes a {@link Cartesian3} with 64-bit floating-point components as two {@link Cartesian3}
* values that, when converted to 32-bit floating-point and added, approximate the original input.
* <p>
* The fixed-point encoding follows <a href="http://blogs.agi.com/insight3d/index.php/2008/09/03/precisions-precisions/">Precisions, Precisions</a>.
* </p>
* @memberof EncodedCartesian3
*
* @param {Cartesian3} cartesian The cartesian to encode.
* @param {EncodedCartesian3} [result] The object onto which to store the result.
* @returns {EncodedCartesian3} The modified result parameter or a new EncodedCartesian3 instance if one was not provided.
*
* @exception {DeveloperError} cartesian is required.
*
* @example
* var cart = new Cartesian3(-10000000.0, 0.0, 10000000.0);
* var encoded = EncodedCartesian3.fromCartesian(cart);
*/
EncodedCartesian3.fromCartesian = function(cartesian, result) {
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required');
}
if (!defined(result)) {
result = new EncodedCartesian3();
}
var high = result.high;
var low = result.low;
EncodedCartesian3.encode(cartesian.x, scratchEncode);
high.x = scratchEncode.high;
low.x = scratchEncode.low;
EncodedCartesian3.encode(cartesian.y, scratchEncode);
high.y = scratchEncode.high;
low.y = scratchEncode.low;
EncodedCartesian3.encode(cartesian.z, scratchEncode);
high.z = scratchEncode.high;
low.z = scratchEncode.low;
return result;
};
var encodedP = new EncodedCartesian3();
/**
* Encodes the provided <code>cartesian</code>, and writes it to an array with <code>high</code>
* components followed by <code>low</code> components, i.e. <code>[high.x, high.y, high.z, low.x, low.y, low.z]</code>.
* <p>
* This is used to create interleaved high-precision position vertex attributes.
* </p>
*
* @param {Cartesian3} cartesian The cartesian to encode.
* @param {Array} cartesianArray The array to write to.
* @param {Number} index The index into the array to start writing. Six elements will be written.
*
* @exception {DeveloperError} cartesian is required.
* @exception {DeveloperError} cartesianArray is required.
* @exception {DeveloperError} index must be a number greater than or equal to 0.
*
* @example
* var positions = [
* new Cartesian3(),
* // ...
* ];
* var encodedPositions = new Float32Array(2 * 3 * positions.length);
* var j = 0;
* for (var i = 0; i < positions.length; ++i) {
* EncodedCartesian3.writeElement(positions[i], encodedPositions, j);
* j += 6;
* }
*/
EncodedCartesian3.writeElements = function(cartesian, cartesianArray, index) {
if (!defined(cartesian)) {
throw new DeveloperError('cartesian is required');
}
if (!defined(cartesianArray)) {
throw new DeveloperError('cartesianArray is required');
}
if (typeof index !== 'number' || index < 0) {
throw new DeveloperError('index must be a number greater than or equal to 0.');
}
EncodedCartesian3.fromCartesian(cartesian, encodedP);
var high = encodedP.high;
var low = encodedP.low;
cartesianArray[index] = high.x;
cartesianArray[index + 1] = high.y;
cartesianArray[index + 2] = high.z;
cartesianArray[index + 3] = low.x;
cartesianArray[index + 4] = low.y;
cartesianArray[index + 5] = low.z;
};
return EncodedCartesian3;
});
/*global define*/
define('Core/QuadraticRealPolynomial',[
'./DeveloperError',
'./Math'
],
function(
DeveloperError,
CesiumMath) {
"use strict";
/**
* Defines functions for 2nd order polynomial functions of one variable with only real coefficients.
*
* @exports QuadraticRealPolynomial
*/
var QuadraticRealPolynomial = {};
/**
* Provides the discriminant of the quadratic equation from the supplied coefficients.
* @memberof QuadraticRealPolynomial
*
* @param {Number} a The coefficient of the 2nd order monomial.
* @param {Number} b The coefficient of the 1st order monomial.
* @param {Number} c The coefficient of the 0th order monomial.
* @returns {Number} The value of the discriminant.
*
* @exception {DeveloperError} a is a required number.
* @exception {DeveloperError} b is a required number.
* @exception {DeveloperError} c is a required number.
*/
QuadraticRealPolynomial.discriminant = function(a, b, c) {
if (typeof a !== 'number') {
throw new DeveloperError('a is a required number.');
}
if (typeof b !== 'number') {
throw new DeveloperError('b is a required number.');
}
if (typeof c !== 'number') {
throw new DeveloperError('c is a required number.');
}
var discriminant = b * b - 4.0 * a * c;
return discriminant;
};
function addWithCancellationCheck(left, right, tolerance) {
var difference = left + right;
if ((CesiumMath.sign(left) !== CesiumMath.sign(right)) &&
Math.abs(difference / Math.max(Math.abs(left), Math.abs(right))) < tolerance) {
return 0.0;
}
return difference;
}
/**
* Provides the real valued roots of the quadratic polynomial with the provided coefficients.
* @memberof QuadraticRealPolynomial
*
* @param {Number} a The coefficient of the 2nd order monomial.
* @param {Number} b The coefficient of the 1st order monomial.
* @param {Number} c The coefficient of the 0th order monomial.
* @returns {Array} The real valued roots.
*
* @exception {DeveloperError} a is a required number.
* @exception {DeveloperError} b is a required number.
* @exception {DeveloperError} c is a required number.
*/
QuadraticRealPolynomial.realRoots = function(a, b, c) {
if (typeof a !== 'number') {
throw new DeveloperError('a is a required number.');
}
if (typeof b !== 'number') {
throw new DeveloperError('b is a required number.');
}
if (typeof c !== 'number') {
throw new DeveloperError('c is a required number.');
}
var ratio;
if (a === 0.0) {
if (b === 0.0) {
// Constant function: c = 0.
return [];
}
// Linear function: b * x + c = 0.
return [-c / b];
} else if (b === 0.0) {
if (c === 0.0) {
// 2nd order monomial: a * x^2 = 0.
return [0.0, 0.0];
}
var cMagnitude = Math.abs(c);
var aMagnitude = Math.abs(a);
if ((cMagnitude < aMagnitude) && (cMagnitude / aMagnitude < CesiumMath.EPSILON14)) { // c ~= 0.0.
// 2nd order monomial: a * x^2 = 0.
return [0.0, 0.0];
} else if ((cMagnitude > aMagnitude) && (aMagnitude / cMagnitude < CesiumMath.EPSILON14)) { // a ~= 0.0.
// Constant function: c = 0.
return [];
}
// a * x^2 + c = 0
ratio = -c / a;
if (ratio < 0.0) {
// Both roots are complex.
return [];
}
// Both roots are real.
var root = Math.sqrt(ratio);
return [-root, root];
} else if (c === 0.0) {
// a * x^2 + b * x = 0
ratio = -b / a;
if (ratio < 0.0) {
return [ratio, 0.0];
}
return [0.0, ratio];
}
// a * x^2 + b * x + c = 0
var b2 = b * b;
var four_ac = 4.0 * a * c;
var radicand = addWithCancellationCheck(b2, -four_ac, CesiumMath.EPSILON14);
if (radicand < 0.0) {
// Both roots are complex.
return [];
}
var q = -0.5 * addWithCancellationCheck(b, CesiumMath.sign(b) * Math.sqrt(radicand), CesiumMath.EPSILON14);
if (b > 0.0) {
return [q / a, c / q];
}
return [c / q, q / a];
};
return QuadraticRealPolynomial;
});
/*global define*/
define('Core/CubicRealPolynomial',[
'./DeveloperError',
'./QuadraticRealPolynomial'
], function(
DeveloperError,
QuadraticRealPolynomial) {
"use strict";
/**
* Defines functions for 3rd order polynomial functions of one variable with only real coefficients.
*
* @exports CubicRealPolynomial
*/
var CubicRealPolynomial = {};
/**
* Provides the discriminant of the cubic equation from the supplied coefficients.
* @memberof CubicRealPolynomial
*
* @param {Number} a The coefficient of the 3rd order monomial.
* @param {Number} b The coefficient of the 2nd order monomial.
* @param {Number} c The coefficient of the 1st order monomial.
* @param {Number} d The coefficient of the 0th order monomial.
* @returns {Number} The value of the discriminant.
*
* @exception {DeveloperError} a is a required number.
* @exception {DeveloperError} b is a required number.
* @exception {DeveloperError} c is a required number.
* @exception {DeveloperError} d is a required number.
*/
CubicRealPolynomial.discriminant = function(a, b, c, d) {
if (typeof a !== 'number') {
throw new DeveloperError('a is a required number.');
}
if (typeof b !== 'number') {
throw new DeveloperError('b is a required number.');
}
if (typeof c !== 'number') {
throw new DeveloperError('c is a required number.');
}
if (typeof d !== 'number') {
throw new DeveloperError('d is a required number.');
}
var a2 = a * a;
var b2 = b * b;
var c2 = c * c;
var d2 = d * d;
var discriminant = 18.0 * a * b * c * d + b2 * c2 - 27.0 * a2 * d2 - 4.0 * (a * c2 * c + b2 * b * d);
return discriminant;
};
function computeRealRoots(a, b, c, d) {
var A = a;
var B = b / 3.0;
var C = c / 3.0;
var D = d;
var AC = A * C;
var BD = B * D;
var B2 = B * B;
var C2 = C * C;
var delta1 = A * C - B2;
var delta2 = A * D - B * C;
var delta3 = B * D - C2;
var discriminant = 4.0 * delta1 * delta3 - delta2 * delta2;
var temp;
var temp1;
if (discriminant < 0.0) {
var ABar;
var CBar;
var DBar;
if (B2 * BD >= AC * C2) {
ABar = A;
CBar = delta1;
DBar = -2.0 * B * delta1 + A * delta2;
} else {
ABar = D;
CBar = delta3;
DBar = -D * delta2 + 2.0 * C * delta3;
}
var s = (DBar < 0.0) ? -1.0 : 1.0; // This is not Math.Sign()!
var temp0 = -s * Math.abs(ABar) * Math.sqrt(-discriminant);
temp1 = -DBar + temp0;
var x = temp1 / 2.0;
var p = x < 0.0 ? -Math.pow(-x, 1.0 / 3.0) : Math.pow(x, 1.0 / 3.0);
var q = (temp1 === temp0) ? -p : -CBar / p;
temp = (CBar <= 0.0) ? p + q : -DBar / (p * p + q * q + CBar);
if (B2 * BD >= AC * C2) {
return [(temp - B) / A];
}
return [-D / (temp + C)];
}
var CBarA = delta1;
var DBarA = -2.0 * B * delta1 + A * delta2;
var CBarD = delta3;
var DBarD = -D * delta2 + 2.0 * C * delta3;
var squareRootOfDiscriminant = Math.sqrt(discriminant);
var halfSquareRootOf3 = Math.sqrt(3.0) / 2.0;
var theta = Math.abs(Math.atan2(A * squareRootOfDiscriminant, -DBarA) / 3.0);
temp = 2.0 * Math.sqrt(-CBarA);
var cosine = Math.cos(theta);
temp1 = temp * cosine;
var temp3 = temp * (-cosine / 2.0 - halfSquareRootOf3 * Math.sin(theta));
var numeratorLarge = (temp1 + temp3 > 2.0 * B) ? temp1 - B : temp3 - B;
var denominatorLarge = A;
var root1 = numeratorLarge / denominatorLarge;
theta = Math.abs(Math.atan2(D * squareRootOfDiscriminant, -DBarD) / 3.0);
temp = 2.0 * Math.sqrt(-CBarD);
cosine = Math.cos(theta);
temp1 = temp * cosine;
temp3 = temp * (-cosine / 2.0 - halfSquareRootOf3 * Math.sin(theta));
var numeratorSmall = -D;
var denominatorSmall = (temp1 + temp3 < 2.0 * C) ? temp1 + C : temp3 + C;
var root3 = numeratorSmall / denominatorSmall;
var E = denominatorLarge * denominatorSmall;
var F = -numeratorLarge * denominatorSmall - denominatorLarge * numeratorSmall;
var G = numeratorLarge * numeratorSmall;
var root2 = (C * F - B * G) / (-B * F + C * E);
if (root1 <= root2) {
if (root1 <= root3) {
if (root2 <= root3) {
return [root1, root2, root3];
}
return [root1, root3, root2];
}
return [root3, root1, root2];
}
if (root1 <= root3) {
return [root2, root1, root3];
}
if (root2 <= root3) {
return [root2, root3, root1];
}
return [root3, root2, root1];
}
/**
* Provides the real valued roots of the cubic polynomial with the provided coefficients.
* @memberof CubicRealPolynomial
*
* @param {Number} a The coefficient of the 3rd order monomial.
* @param {Number} b The coefficient of the 2nd order monomial.
* @param {Number} c The coefficient of the 1st order monomial.
* @param {Number} d The coefficient of the 0th order monomial.
* @returns {Array} The real valued roots.
*
* @exception {DeveloperError} a is a required number.
* @exception {DeveloperError} b is a required number.
* @exception {DeveloperError} c is a required number.
* @exception {DeveloperError} d is a required number.
*/
CubicRealPolynomial.realRoots = function(a, b, c, d) {
if (typeof a !== 'number') {
throw new DeveloperError('a is a required number.');
}
if (typeof b !== 'number') {
throw new DeveloperError('b is a required number.');
}
if (typeof c !== 'number') {
throw new DeveloperError('c is a required number.');
}
if (typeof d !== 'number') {
throw new DeveloperError('d is a required number.');
}
var roots;
var ratio;
if (a === 0.0) {
// Quadratic function: b * x^2 + c * x + d = 0.
return QuadraticRealPolynomial.realRoots(b, c, d);
} else if (b === 0.0) {
if (c === 0.0) {
if (d === 0.0) {
// 3rd order monomial: a * x^3 = 0.
return [0.0, 0.0, 0.0];
}
// a * x^3 + d = 0
ratio = -d / a;
var root = (ratio < 0.0) ? -Math.pow(-ratio, 1.0 / 3.0) : Math.pow(ratio, 1.0 / 3.0);
return [root, root, root];
} else if (d === 0.0) {
// x * (a * x^2 + c) = 0.
roots = QuadraticRealPolynomial.realRoots(a, 0, c);
// Return the roots in ascending order.
if (roots.Length === 0) {
return [0.0];
}
return [roots[0], 0.0, roots[1]];
}
// Deflated cubic polynomial: a * x^3 + c * x + d= 0.
return computeRealRoots(a, 0, c, d);
} else if (c === 0.0) {
if (d === 0.0) {
// x^2 * (a * x + b) = 0.
ratio = -b / a;
if (ratio < 0.0) {
return [ratio, 0.0, 0.0];
}
return [0.0, 0.0, ratio];
}
// a * x^3 + b * x^2 + d = 0.
return computeRealRoots(a, b, 0, d);
} else if (d === 0.0) {
// x * (a * x^2 + b * x + c) = 0
roots = QuadraticRealPolynomial.realRoots(a, b, c);
// Return the roots in ascending order.
if (roots.length === 0) {
return [0.0];
} else if (roots[1] <= 0.0) {
return [roots[0], roots[1], 0.0];
} else if (roots[0] >= 0.0) {
return [0.0, roots[0], roots[1]];
}
return [roots[0], 0.0, roots[1]];
}
return computeRealRoots(a, b, c, d);
};
return CubicRealPolynomial;
});
/*global define*/
define('Core/QuarticRealPolynomial',[
'./DeveloperError',
'./Math',
'./CubicRealPolynomial',
'./QuadraticRealPolynomial'
],
function(
DeveloperError,
CesiumMath,
CubicRealPolynomial,
QuadraticRealPolynomial) {
"use strict";
/**
* Defines functions for 4th order polynomial functions of one variable with only real coefficients.
*
* @exports QuarticRealPolynomial
*/
var QuarticRealPolynomial = {};
/**
* Provides the discriminant of the quartic equation from the supplied coefficients.
* @memberof QuarticRealPolynomial
*
* @param {Number} a The coefficient of the 4th order monomial.
* @param {Number} b The coefficient of the 3rd order monomial.
* @param {Number} c The coefficient of the 2nd order monomial.
* @param {Number} d The coefficient of the 1st order monomial.
* @param {Number} e The coefficient of the 0th order monomial.
* @returns {Number} The value of the discriminant.
*
* @exception {DeveloperError} a is a required number.
* @exception {DeveloperError} b is a required number.
* @exception {DeveloperError} c is a required number.
* @exception {DeveloperError} d is a required number.
* @exception {DeveloperError} e is a required number.
*/
QuarticRealPolynomial.discriminant = function(a, b, c, d, e) {
if (typeof a !== 'number') {
throw new DeveloperError('a is a required number.');
}
if (typeof b !== 'number') {
throw new DeveloperError('b is a required number.');
}
if (typeof c !== 'number') {
throw new DeveloperError('c is a required number.');
}
if (typeof d !== 'number') {
throw new DeveloperError('d is a required number.');
}
if (typeof e !== 'number') {
throw new DeveloperError('e is a required number.');
}
var a2 = a * a;
var a3 = a2 * a;
var b2 = b * b;
var b3 = b2 * b;
var c2 = c * c;
var c3 = c2 * c;
var d2 = d * d;
var d3 = d2 * d;
var e2 = e * e;
var e3 = e2 * e;
var discriminant = (b2 * c2 * d2 - 4.0 * b3 * d3 - 4.0 * a * c3 * d2 + 18 * a * b * c * d3 - 27.0 * a2 * d2 * d2 + 256.0 * a3 * e3) +
e * (18.0 * b3 * c * d - 4.0 * b2 * c3 + 16.0 * a * c2 * c2 - 80.0 * a * b * c2 * d - 6.0 * a * b2 * d2 + 144.0 * a2 * c * d2) +
e2 * (144.0 * a * b2 * c - 27.0 * b2 * b2 - 128.0 * a2 * c2 - 192.0 * a2 * b * d);
return discriminant;
};
function original(a3, a2, a1, a0) {
var a3Squared = a3 * a3;
var p = a2 - 3.0 * a3Squared / 8.0;
var q = a1 - a2 * a3 / 2.0 + a3Squared * a3 / 8.0;
var r = a0 - a1 * a3 / 4.0 + a2 * a3Squared / 16.0 - 3.0 * a3Squared * a3Squared / 256.0;
// Find the roots of the cubic equations: h^6 + 2 p h^4 + (p^2 - 4 r) h^2 - q^2 = 0.
var cubicRoots = CubicRealPolynomial.realRoots(1.0, 2.0 * p, p * p - 4.0 * r, -q * q);
if (cubicRoots.length > 0) {
var temp = -a3 / 4.0;
// Use the largest positive root.
var hSquared = cubicRoots[cubicRoots.length - 1];
if (Math.abs(hSquared) < CesiumMath.EPSILON14) {
// y^4 + p y^2 + r = 0.
var roots = QuadraticRealPolynomial.realRoots(1.0, p, r);
if (roots.length === 2) {
var root0 = roots[0];
var root1 = roots[1];
var y;
if (root0 >= 0.0 && root1 >= 0.0) {
var y0 = Math.sqrt(root0);
var y1 = Math.sqrt(root1);
return [temp - y1, temp - y0, temp + y0, temp + y1];
} else if (root0 >= 0.0 && root1 < 0.0) {
y = Math.sqrt(root0);
return [temp - y, temp + y];
} else if (root0 < 0.0 && root1 >= 0.0) {
y = Math.sqrt(root1);
return [temp - y, temp + y];
}
}
return [];
} else if (hSquared > 0.0) {
var h = Math.sqrt(hSquared);
var m = (p + hSquared - q / h) / 2.0;
var n = (p + hSquared + q / h) / 2.0;
// Now solve the two quadratic factors: (y^2 + h y + m)(y^2 - h y + n);
var roots1 = QuadraticRealPolynomial.realRoots(1.0, h, m);
var roots2 = QuadraticRealPolynomial.realRoots(1.0, -h, n);
if (roots1.length !== 0) {
roots1[0] += temp;
roots1[1] += temp;
if (roots2.length !== 0) {
roots2[0] += temp;
roots2[1] += temp;
if (roots1[1] <= roots2[0]) {
return [roots1[0], roots1[1], roots2[0], roots2[1]];
} else if (roots2[1] <= roots1[0]) {
return [roots2[0], roots2[1], roots1[0], roots1[1]];
} else if (roots1[0] >= roots2[0] && roots1[1] <= roots2[1]) {
return [roots2[0], roots1[0], roots1[1], roots2[1]];
} else if (roots2[0] >= roots1[0] && roots2[1] <= roots1[1]) {
return [roots1[0], roots2[0], roots2[1], roots1[1]];
} else if (roots1[0] > roots2[0] && roots1[0] < roots2[1]) {
return [roots2[0], roots1[0], roots2[1], roots1[1]];
}
return [roots1[0], roots2[0], roots1[1], roots2[1]];
}
return roots1;
}
if (roots2.length !== 0) {
roots2[0] += temp;
roots2[1] += temp;
return roots2;
}
return [];
}
}
return [];
}
function neumark(a3, a2, a1, a0) {
var a1Squared = a1 * a1;
var a2Squared = a2 * a2;
var a3Squared = a3 * a3;
var p = -2.0 * a2;
var q = a1 * a3 + a2Squared - 4.0 * a0;
var r = a3Squared * a0 - a1 * a2 * a3 + a1Squared;
var cubicRoots = CubicRealPolynomial.realRoots(1.0, p, q, r);
if (cubicRoots.length > 0) {
// Use the most positive root
var y = cubicRoots[0];
var temp = (a2 - y);
var tempSquared = temp * temp;
var g1 = a3 / 2.0;
var h1 = temp / 2.0;
var m = tempSquared - 4.0 * a0;
var mError = tempSquared + 4.0 * Math.abs(a0);
var n = a3Squared - 4.0 * y;
var nError = a3Squared + 4.0 * Math.abs(y);
var g2;
var h2;
if (y < 0.0 || (m * nError < n * mError)) {
var squareRootOfN = Math.sqrt(n);
g2 = squareRootOfN / 2.0;
h2 = squareRootOfN === 0.0 ? 0.0 : (a3 * h1 - a1) / squareRootOfN;
} else {
var squareRootOfM = Math.sqrt(m);
g2 = squareRootOfM === 0.0 ? 0.0 : (a3 * h1 - a1) / squareRootOfM;
h2 = squareRootOfM / 2.0;
}
var G;
var g;
if (g1 === 0.0 && g2 === 0.0) {
G = 0.0;
g = 0.0;
} else if (CesiumMath.sign(g1) === CesiumMath.sign(g2)) {
G = g1 + g2;
g = y / G;
} else {
g = g1 - g2;
G = y / g;
}
var H;
var h;
if (h1 === 0.0 && h2 === 0.0) {
H = 0.0;
h = 0.0;
} else if (CesiumMath.sign(h1) === CesiumMath.sign(h2)) {
H = h1 + h2;
h = a0 / H;
} else {
h = h1 - h2;
H = a0 / h;
}
// Now solve the two quadratic factors: (y^2 + G y + H)(y^2 + g y + h);
var roots1 = QuadraticRealPolynomial.realRoots(1.0, G, H);
var roots2 = QuadraticRealPolynomial.realRoots(1.0, g, h);
if (roots1.length !== 0) {
if (roots2.length !== 0) {
if (roots1[1] <= roots2[0]) {
return [roots1[0], roots1[1], roots2[0], roots2[1]];
} else if (roots2[1] <= roots1[0]) {
return [roots2[0], roots2[1], roots1[0], roots1[1]];
} else if (roots1[0] >= roots2[0] && roots1[1] <= roots2[1]) {
return [roots2[0], roots1[0], roots1[1], roots2[1]];
} else if (roots2[0] >= roots1[0] && roots2[1] <= roots1[1]) {
return [roots1[0], roots2[0], roots2[1], roots1[1]];
} else if (roots1[0] > roots2[0] && roots1[0] < roots2[1]) {
return [roots2[0], roots1[0], roots2[1], roots1[1]];
} else {
return [roots1[0], roots2[0], roots1[1], roots2[1]];
}
}
return roots1;
}
if (roots2.length !== 0) {
return roots2;
}
}
return [];
}
/**
* Provides the real valued roots of the quartic polynomial with the provided coefficients.
* @memberof QuarticRealPolynomial
*
* @param {Number} a The coefficient of the 4th order monomial.
* @param {Number} b The coefficient of the 3rd order monomial.
* @param {Number} c The coefficient of the 2nd order monomial.
* @param {Number} d The coefficient of the 1st order monomial.
* @param {Number} e The coefficient of the 0th order monomial.
* @returns {Array} The real valued roots.
*
* @exception {DeveloperError} a is a required number.
* @exception {DeveloperError} b is a required number.
* @exception {DeveloperError} c is a required number.
* @exception {DeveloperError} d is a required number.
* @exception {DeveloperError} e is a required number.
*/
QuarticRealPolynomial.realRoots = function(a, b, c, d, e) {
if (typeof a !== 'number') {
throw new DeveloperError('a is a required number.');
}
if (typeof b !== 'number') {
throw new DeveloperError('b is a required number.');
}
if (typeof c !== 'number') {
throw new DeveloperError('c is a required number.');
}
if (typeof d !== 'number') {
throw new DeveloperError('d is a required number.');
}
if (typeof e !== 'number') {
throw new DeveloperError('e is a required number.');
}
if (Math.abs(a) < CesiumMath.EPSILON15) {
return CubicRealPolynomial.realRoots(b, c, d, e);
}
var a3 = b / a;
var a2 = c / a;
var a1 = d / a;
var a0 = e / a;
var k = (a3 < 0.0) ? 1 : 0;
k += (a2 < 0.0) ? k + 1 : k;
k += (a1 < 0.0) ? k + 1 : k;
k += (a0 < 0.0) ? k + 1 : k;
switch (k) {
case 0:
return original(a3, a2, a1, a0);
case 1:
return neumark(a3, a2, a1, a0);
case 2:
return neumark(a3, a2, a1, a0);
case 3:
return original(a3, a2, a1, a0);
case 4:
return original(a3, a2, a1, a0);
case 5:
return neumark(a3, a2, a1, a0);
case 6:
return original(a3, a2, a1, a0);
case 7:
return original(a3, a2, a1, a0);
case 8:
return neumark(a3, a2, a1, a0);
case 9:
return original(a3, a2, a1, a0);
case 10:
return original(a3, a2, a1, a0);
case 11:
return neumark(a3, a2, a1, a0);
case 12:
return original(a3, a2, a1, a0);
case 13:
return original(a3, a2, a1, a0);
case 14:
return original(a3, a2, a1, a0);
case 15:
return original(a3, a2, a1, a0);
default:
return undefined;
}
};
return QuarticRealPolynomial;
});
/*global define*/
define('Core/IntersectionTests',[
'./defined',
'./DeveloperError',
'./Math',
'./Cartesian3',
'./Cartographic',
'./Matrix3',
'./QuadraticRealPolynomial',
'./QuarticRealPolynomial'
],
function(
defined,
DeveloperError,
CesiumMath,
Cartesian3,
Cartographic,
Matrix3,
QuadraticRealPolynomial,
QuarticRealPolynomial) {
"use strict";
/**
* DOC_TBA
*
* @exports IntersectionTests
*/
var IntersectionTests = {};
/**
* Computes the intersection of a ray and a plane.
* @memberof IntersectionTests
*
* @param {Ray} ray The ray.
* @param {Plane} plane The plane.
* @returns {Cartesian3} The intersection point or undefined if there is no intersections.
*
* @exception {DeveloperError} ray is required.
* @exception {DeveloperError} plane is required.
*/
IntersectionTests.rayPlane = function(ray, plane, result) {
if (!defined(ray)) {
throw new DeveloperError('ray is required.');
}
if (!defined(plane)) {
throw new DeveloperError('plane is required.');
}
var origin = ray.origin;
var direction = ray.direction;
var normal = plane.normal;
var denominator = Cartesian3.dot(normal, direction);
if (Math.abs(denominator) < CesiumMath.EPSILON15) {
// Ray is parallel to plane. The ray may be in the polygon's plane.
return undefined;
}
var t = (-plane.distance - Cartesian3.dot(normal, origin)) / denominator;
if (t < 0) {
return undefined;
}
result = Cartesian3.multiplyByScalar(direction, t, result);
return Cartesian3.add(origin, result, result);
};
/**
* Computes the intersection points of a ray with an ellipsoid.
* @memberof IntersectionTests
*
* @param {Ray} ray The ray.
* @param {Ellipsoid} ellipsoid The ellipsoid.
* @returns {Object} An object with the first (<code>start</code>) and the second (<code>stop</code>) intersection scalars for points along the ray or undefined if there are no intersections.
*
* @exception {DeveloperError} ray is required.
* @exception {DeveloperError} ellipsoid is required.
*/
IntersectionTests.rayEllipsoid = function(ray, ellipsoid) {
if (!defined(ray)) {
throw new DeveloperError('ray is required.');
}
if (!defined(ellipsoid)) {
throw new DeveloperError('ellipsoid is required.');
}
var inverseRadii = ellipsoid.getOneOverRadii();
var q = Cartesian3.multiplyComponents(inverseRadii, ray.origin);
var w = Cartesian3.multiplyComponents(inverseRadii, ray.direction);
var q2 = Cartesian3.magnitudeSquared(q);
var qw = Cartesian3.dot(q, w);
var difference, w2, product, discriminant, temp;
if (q2 > 1.0) {
// Outside ellipsoid.
if (qw >= 0.0) {
// Looking outward or tangent (0 intersections).
return undefined;
}
// qw < 0.0.
var qw2 = qw * qw;
difference = q2 - 1.0; // Positively valued.
w2 = Cartesian3.magnitudeSquared(w);
product = w2 * difference;
if (qw2 < product) {
// Imaginary roots (0 intersections).
return undefined;
} else if (qw2 > product) {
// Distinct roots (2 intersections).
discriminant = qw * qw - product;
temp = -qw + Math.sqrt(discriminant); // Avoid cancellation.
var root0 = temp / w2;
var root1 = difference / temp;
if (root0 < root1) {
return {
start : root0,
stop : root1
};
}
return {
start : root1,
stop : root0
};
} else {
// qw2 == product. Repeated roots (2 intersections).
var root = Math.sqrt(difference / w2);
return {
start : root,
stop : root
};
}
} else if (q2 < 1.0) {
// Inside ellipsoid (2 intersections).
difference = q2 - 1.0; // Negatively valued.
w2 = Cartesian3.magnitudeSquared(w);
product = w2 * difference; // Negatively valued.
discriminant = qw * qw - product;
temp = -qw + Math.sqrt(discriminant); // Positively valued.
return {
start : 0.0,
stop : temp / w2
};
} else {
// q2 == 1.0. On ellipsoid.
if (qw < 0.0) {
// Looking inward.
w2 = Cartesian3.magnitudeSquared(w);
return {
start : 0.0,
stop : -qw / w2
};
}
// qw >= 0.0. Looking outward or tangent.
return undefined;
}
};
function addWithCancellationCheck(left, right, tolerance) {
var difference = left + right;
if ((CesiumMath.sign(left) !== CesiumMath.sign(right)) &&
Math.abs(difference / Math.max(Math.abs(left), Math.abs(right))) < tolerance) {
return 0.0;
}
return difference;
}
function quadraticVectorExpression(A, b, c, x, w) {
var xSquared = x * x;
var wSquared = w * w;
var l2 = (A[Matrix3.COLUMN1ROW1] - A[Matrix3.COLUMN2ROW2]) * wSquared;
var l1 = w * (x * addWithCancellationCheck(A[Matrix3.COLUMN1ROW0], A[Matrix3.COLUMN0ROW1], CesiumMath.EPSILON15) + b.y);
var l0 = (A[Matrix3.COLUMN0ROW0] * xSquared + A[Matrix3.COLUMN2ROW2] * wSquared) + x * b.x + c;
var r1 = wSquared * addWithCancellationCheck(A[Matrix3.COLUMN2ROW1], A[Matrix3.COLUMN1ROW2], CesiumMath.EPSILON15);
var r0 = w * (x * addWithCancellationCheck(A[Matrix3.COLUMN2ROW0], A[Matrix3.COLUMN0ROW2]) + b.z);
var cosines;
var solutions = [];
if (r0 === 0.0 && r1 === 0.0) {
cosines = QuadraticRealPolynomial.realRoots(l2, l1, l0);
if (cosines.length === 0) {
return solutions;
}
var cosine0 = cosines[0];
var sine0 = Math.sqrt(Math.max(1.0 - cosine0 * cosine0, 0.0));
solutions.push(new Cartesian3(x, w * cosine0, w * -sine0));
solutions.push(new Cartesian3(x, w * cosine0, w * sine0));
if (cosines.length === 2) {
var cosine1 = cosines[1];
var sine1 = Math.sqrt(Math.max(1.0 - cosine1 * cosine1, 0.0));
solutions.push(new Cartesian3(x, w * cosine1, w * -sine1));
solutions.push(new Cartesian3(x, w * cosine1, w * sine1));
}
return solutions;
}
var r0Squared = r0 * r0;
var r1Squared = r1 * r1;
var l2Squared = l2 * l2;
var r0r1 = r0 * r1;
var c4 = l2Squared + r1Squared;
var c3 = 2.0 * (l1 * l2 + r0r1);
var c2 = 2.0 * l0 * l2 + l1 * l1 - r1Squared + r0Squared;
var c1 = 2.0 * (l0 * l1 - r0r1);
var c0 = l0 * l0 - r0Squared;
if (c4 === 0.0 && c3 === 0.0 && c2 === 0.0 && c1 === 0.0) {
return solutions;
}
cosines = QuarticRealPolynomial.realRoots(c4, c3, c2, c1, c0);
var length = cosines.length;
if (length === 0) {
return solutions;
}
for ( var i = 0; i < length; ++i) {
var cosine = cosines[i];
var cosineSquared = cosine * cosine;
var sineSquared = Math.max(1.0 - cosineSquared, 0.0);
var sine = Math.sqrt(sineSquared);
//var left = l2 * cosineSquared + l1 * cosine + l0;
var left;
if (CesiumMath.sign(l2) === CesiumMath.sign(l0)) {
left = addWithCancellationCheck(l2 * cosineSquared + l0, l1 * cosine, CesiumMath.EPSILON12);
} else if (CesiumMath.sign(l0) === CesiumMath.sign(l1 * cosine)) {
left = addWithCancellationCheck(l2 * cosineSquared, l1 * cosine + l0, CesiumMath.EPSILON12);
} else {
left = addWithCancellationCheck(l2 * cosineSquared + l1 * cosine, l0, CesiumMath.EPSILON12);
}
var right = addWithCancellationCheck(r1 * cosine, r0, CesiumMath.EPSILON15);
var product = left * right;
if (product < 0.0) {
solutions.push(new Cartesian3(x, w * cosine, w * sine));
} else if (product > 0.0) {
solutions.push(new Cartesian3(x, w * cosine, w * -sine));
} else if (sine !== 0.0) {
solutions.push(new Cartesian3(x, w * cosine, w * -sine));
solutions.push(new Cartesian3(x, w * cosine, w * sine));
++i;
} else {
solutions.push(new Cartesian3(x, w * cosine, w * sine));
}
}
return solutions;
}
/**
* Provides the point along the ray which is nearest to the ellipsoid.
* @memberof IntersectionTests
*
* @param {Ray} ray The ray.
* @param {Ellipsoid} ellipsoid The ellipsoid.
* @returns {Cartesian} The nearest planetodetic point on the ray.
*
* @exception {DeveloperError} ray is required.
* @exception {DeveloperError} ellipsoid is required.
*/
IntersectionTests.grazingAltitudeLocation = function(ray, ellipsoid) {
if (!defined(ray)) {
throw new DeveloperError('ray is required.');
}
if (!defined(ellipsoid)) {
throw new DeveloperError('ellipsoid is required.');
}
var position = ray.origin;
var direction = ray.direction;
var normal = ellipsoid.geodeticSurfaceNormal(position);
if (Cartesian3.dot(direction, normal) >= 0.0) { // The location provided is the closest point in altitude
return position;
}
var intersects = defined(this.rayEllipsoid(ray, ellipsoid));
// Compute the scaled direction vector.
var f = ellipsoid.transformPositionToScaledSpace(direction);
// Constructs a basis from the unit scaled direction vector. Construct its rotation and transpose.
var firstAxis = Cartesian3.normalize(f);
var reference = Cartesian3.mostOrthogonalAxis(f);
var secondAxis = Cartesian3.normalize(Cartesian3.cross(reference, firstAxis));
var thirdAxis = Cartesian3.normalize(Cartesian3.cross(firstAxis, secondAxis));
var B = new Matrix3(firstAxis.x, secondAxis.x, thirdAxis.x,
firstAxis.y, secondAxis.y, thirdAxis.y,
firstAxis.z, secondAxis.z, thirdAxis.z);
var B_T = B.transpose();
// Get the scaling matrix and its inverse.
var D_I = Matrix3.fromScale(ellipsoid.getRadii());
var D = Matrix3.fromScale(ellipsoid.getOneOverRadii());
var C = new Matrix3(0.0, direction.z, -direction.y,
-direction.z, 0.0, direction.x,
direction.y, -direction.x, 0.0);
var temp = B_T.multiply(D).multiply(C);
var A = temp.multiply(D_I).multiply(B);
var b = temp.multiplyByVector(position);
// Solve for the solutions to the expression in standard form:
var solutions = quadraticVectorExpression(A, Cartesian3.negate(b), 0.0, 0.0, 1.0);
var s;
var altitude;
var length = solutions.length;
if (length > 0) {
var closest = Cartesian3.ZERO;
var maximumValue = Number.NEGATIVE_INFINITY;
for ( var i = 0; i < length; ++i) {
s = D_I.multiplyByVector(B.multiplyByVector(solutions[i]));
var v = Cartesian3.normalize(Cartesian3.subtract(s, position));
var dotProduct = Cartesian3.dot(v, direction);
if (dotProduct > maximumValue) {
maximumValue = dotProduct;
closest = s;
}
}
var surfacePoint = ellipsoid.cartesianToCartographic(closest);
maximumValue = CesiumMath.clamp(maximumValue, 0.0, 1.0);
altitude = Cartesian3.magnitude(Cartesian3.subtract(closest, position)) * Math.sqrt(1.0 - maximumValue * maximumValue);
altitude = intersects ? -altitude : altitude;
return ellipsoid.cartographicToCartesian(new Cartographic(surfacePoint.longitude, surfacePoint.latitude, altitude));
}
return undefined;
};
var lineSegmentPlaneDifference = new Cartesian3();
/**
* Computes the intersection of a line segment and a plane.
* @memberof IntersectionTests
*
* @param {Cartesian3} endPoint0 An end point of the line segment.
* @param {Cartesian3} endPoint1 The other end point of the line segment.
* @param {Plane} plane The plane.
* @param {Cartesian3} [result] The object onto which to store the result.
* @returns {Cartesian3} The intersection point or undefined if there is no intersection.
*
* @exception {DeveloperError} endPoint0 is required.
* @exception {DeveloperError} endPoint1 is required.
* @exception {DeveloperError} plane is required.
*
* @example
* var origin = ellipsoid.cartographicToCartesian(Cartographic.fromDegrees(-75.59777, 40.03883, 0.0));
* var normal = ellipsoid.geodeticSurfaceNormal(origin);
* var plane = Plane.fromPointNormal(origin, normal);
*
* var p0 = new Cartesian3(...);
* var p1 = new Cartesian3(...);
*
* // find the intersection of the line segment from p0 to p1 and the tangent plane at origin.
* var intersection = IntersectionTests.lineSegmentPlane(p0, p1, plane);
*/
IntersectionTests.lineSegmentPlane = function(endPoint0, endPoint1, plane, result) {
if (!defined(endPoint0)) {
throw new DeveloperError('endPoint0 is required.');
}
if (!defined(endPoint1)) {
throw new DeveloperError('endPoint1 is required.');
}
if (!defined(plane)) {
throw new DeveloperError('plane is required.');
}
var difference = Cartesian3.subtract(endPoint1, endPoint0, lineSegmentPlaneDifference);
var normal = plane.normal;
var nDotDiff = Cartesian3.dot(normal, difference);
// check if the segment and plane are parallel
if (Math.abs(nDotDiff) < CesiumMath.EPSILON6) {
return undefined;
}
var nDotP0 = Cartesian3.dot(normal, endPoint0);
var t = -(plane.distance + nDotP0) / nDotDiff;
// intersection only if t is in [0, 1]
if (t < 0.0 || t > 1.0) {
return undefined;
}
// intersection is endPoint0 + t * (endPoint1 - endPoint0)
if (!defined(result)) {
result = new Cartesian3();
}
Cartesian3.multiplyByScalar(difference, t, result);
Cartesian3.add(endPoint0, result, result);
return result;
};
/**
* Computes the intersection of a triangle and a plane
* @memberof IntersectionTests
*
* @param {Cartesian3} p0 First point of the triangle
* @param {Cartesian3} p1 Second point of the triangle
* @param {Cartesian3} p2 Third point of the triangle
* @param {Plane} plane Intersection plane
*
* @returns {Object} An object with properties <code>positions</code> and <code>indices</code>, which are arrays that represent three triangles that do not cross the plane. (Undefined if no intersection exists)
*
* @exception {DeveloperError} p0, p1, p2, and plane are required.
*
* @example
* var origin = ellipsoid.cartographicToCartesian(Cartographic.fromDegrees(-75.59777, 40.03883, 0.0));
* var normal = ellipsoid.geodeticSurfaceNormal(origin);
* var plane = Plane.fromPointNormal(origin, normal);
*
* var p0 = new Cartesian3(...);
* var p1 = new Cartesian3(...);
* var p2 = new Cartesian3(...);
*
* // convert the triangle composed of points (p0, p1, p2) to three triangles that don't cross the plane
* var triangles = IntersectionTests.lineSegmentPlane(p0, p1, p2, plane);
*
*/
IntersectionTests.trianglePlaneIntersection = function(p0, p1, p2, plane) {
if ((!defined(p0)) ||
(!defined(p1)) ||
(!defined(p2)) ||
(!defined(plane))) {
throw new DeveloperError('p0, p1, p2, and plane are required.');
}
var planeNormal = plane.normal;
var planeD = plane.distance;
var p0Behind = (Cartesian3.dot(planeNormal, p0) + planeD) < 0.0;
var p1Behind = (Cartesian3.dot(planeNormal, p1) + planeD) < 0.0;
var p2Behind = (Cartesian3.dot(planeNormal, p2) + planeD) < 0.0;
// Given these dots products, the calls to lineSegmentPlaneIntersection
// always have defined results.
var numBehind = 0;
numBehind += p0Behind ? 1 : 0;
numBehind += p1Behind ? 1 : 0;
numBehind += p2Behind ? 1 : 0;
var u1, u2;
if (numBehind === 1 || numBehind === 2) {
u1 = new Cartesian3();
u2 = new Cartesian3();
}
if (numBehind === 1) {
if (p0Behind) {
IntersectionTests.lineSegmentPlane(p0, p1, plane, u1);
IntersectionTests.lineSegmentPlane(p0, p2, plane, u2);
return {
positions : [p0, p1, p2, u1, u2 ],
indices : [
// Behind
0, 3, 4,
// In front
1, 2, 4,
1, 4, 3
]
};
} else if (p1Behind) {
IntersectionTests.lineSegmentPlane(p1, p2, plane, u1);
IntersectionTests.lineSegmentPlane(p1, p0, plane, u2);
return {
positions : [p0, p1, p2, u1, u2 ],
indices : [
// Behind
1, 3, 4,
// In front
2, 0, 4,
2, 4, 3
]
};
} else if (p2Behind) {
IntersectionTests.lineSegmentPlane(p2, p0, plane, u1);
IntersectionTests.lineSegmentPlane(p2, p1, plane, u2);
return {
positions : [p0, p1, p2, u1, u2 ],
indices : [
// Behind
2, 3, 4,
// In front
0, 1, 4,
0, 4, 3
]
};
}
} else if (numBehind === 2) {
if (!p0Behind) {
IntersectionTests.lineSegmentPlane(p1, p0, plane, u1);
IntersectionTests.lineSegmentPlane(p2, p0, plane, u2);
return {
positions : [p0, p1, p2, u1, u2 ],
indices : [
// Behind
1, 2, 4,
1, 4, 3,
// In front
0, 3, 4
]
};
} else if (!p1Behind) {
IntersectionTests.lineSegmentPlane(p2, p1, plane, u1);
IntersectionTests.lineSegmentPlane(p0, p1, plane, u2);
return {
positions : [p0, p1, p2, u1, u2 ],
indices : [
// Behind
2, 0, 4,
2, 4, 3,
// In front
1, 3, 4
]
};
} else if (!p2Behind) {
IntersectionTests.lineSegmentPlane(p0, p2, plane, u1);
IntersectionTests.lineSegmentPlane(p1, p2, plane, u2);
return {
positions : [p0, p1, p2, u1, u2 ],
indices : [
// Behind
0, 1, 4,
0, 4, 3,
// In front
2, 3, 4
]
};
}
}
// if numBehind is 3, the triangle is completely behind the plane;
// otherwise, it is completely in front (numBehind is 0).
return undefined;
};
return IntersectionTests;
});
/*global define*/
define('Core/Plane',[
'./Cartesian3',
'./defined',
'./DeveloperError'
], function(
Cartesian3,
defined,
DeveloperError) {
"use strict";
/**
* A plane in Hessian Normal Form defined by
* <pre>
* ax + by + cz + d = 0
* </pre>
* where (a, b, c) is the plane's <code>normal</code>, d is the signed
* <code>distance</code> to the plane, and (x, y, z) is any point on
* the plane.
*
* @alias Plane
* @constructor
*
* @param {Cartesian3} normal The plane's normal (normalized).
* @param {Number} distance The shortest distance from the origin to the plane. The sign of
* <code>distance</code> determines which side of the plane the origin
* is on. If <code>distance</code> is positive, the origin is in the half-space
* in the direction of the normal; if negative, the origin is in the half-space
* opposite to the normal; if zero, the plane passes through the origin.
*
* @exception {DeveloperError} normal is required.
* @exception {DeveloperError} distance is required.
*
* @example
* // The plane x=0
* var plane = new Plane(Cartesian3.UNIT_X, 0.0);
*/
var Plane = function(normal, distance) {
if (!defined(normal)) {
throw new DeveloperError('normal is required.');
}
if (!defined(distance)) {
throw new DeveloperError('distance is required.');
}
/**
* The plane's normal.
*
* @type {Cartesian3}
*/
this.normal = Cartesian3.clone(normal);
/**
* The shortest distance from the origin to the plane. The sign of
* <code>distance</code> determines which side of the plane the origin
* is on. If <code>distance</code> is positive, the origin is in the half-space
* in the direction of the normal; if negative, the origin is in the half-space
* opposite to the normal; if zero, the plane passes through the origin.
*
* @type {Number}
*/
this.distance = distance;
};
/**
* Creates a plane from a normal and a point on the plane.
* @memberof Plane
*
* @param {Cartesian3} point The point on the plane.
* @param {Cartesian3} normal The plane's normal (normalized).
* @param {Plane} [result] The object onto which to store the result.
* @returns {Plane} A new plane instance or the modified result parameter.
*
* @exception {DeveloperError} point is required.
* @exception {DeveloperError} normal is required.
*
* @example
* var point = ellipsoid.cartographicToCartesian(Cartographic.fromDegrees(-72.0, 40.0));
* var normal = ellipsoid.geodeticSurfaceNormal(point);
* var tangentPlane = Plane.fromPointNormal(point, normal);
*/
Plane.fromPointNormal = function(point, normal, result) {
if (!defined(point)) {
throw new DeveloperError('point is required.');
}
if (!defined(normal)) {
throw new DeveloperError('normal is required.');
}
var distance = -Cartesian3.dot(normal, point);
if (!defined(result)) {
return new Plane(normal, distance);
}
Cartesian3.clone(normal, result.normal);
result.distance = distance;
return result;
};
/**
* Computes the signed shortest distance of a point to a plane.
* The sign of the distance determines which side of the plane the point
* is on. If the distance is positive, the point is in the half-space
* in the direction of the normal; if negative, the point is in the half-space
* opposite to the normal; if zero, the plane passes through the point.
* @memberof Plane
*
* @param {Plane} plane The plane.
* @param {Cartesian3} point The point.
* @returns {Number} The signed shortest distance of the point to the plane.
*
* @exception {DeveloperError} plane is required.
* @exception {DeveloperError} point is required.
*/
Plane.getPointDistance = function(plane, point) {
if (!defined(plane)) {
throw new DeveloperError('plane is required.');
}
if (!defined(point)) {
throw new DeveloperError('point is required.');
}
return Cartesian3.dot(plane.normal, point) + plane.distance;
};
/**
* Computes the signed shortest distance of a point to this plane.
* The sign of the distance determines which side of this plane the point
* is on. If the distance is positive, the point is in the half-space
* in the direction of the normal; if negative, the point is in the half-space
* opposite to the normal; if zero, this plane passes through the point.
* @memberof Plane
*
* @param {Cartesian3} point The point.
* @returns {Number} The signed shortest distance of the point to this plane.
*
* @exception {DeveloperError} point is required.
*/
Plane.prototype.getPointDistance = function(point) {
return Plane.getPointDistance(this, point);
};
return Plane;
});
/*global define*/
define('Core/IndexDatatype',[
'./Enumeration',
'./defined',
'./DeveloperError',
'./FeatureDetection',
'./Math'
], function(
Enumeration,
defined,
DeveloperError,
FeatureDetection,
CesiumMath) {
"use strict";
// Bail out if the browser doesn't support typed arrays, to prevent the setup function
// from failing, since we won't be able to create a WebGL context anyway.
if (!FeatureDetection.supportsTypedArrays()) {
return {};
}
/**
* Enumerations for WebGL index datatypes. These corresponds to the
* <code>type</code> parameter of <a href="http://www.khronos.org/opengles/sdk/docs/man/xhtml/glDrawElements.xml">drawElements</a>.
*
* @alias IndexDatatype
* @enumeration
*/
var IndexDatatype = {
/**
* 8-bit unsigned byte enumeration corresponding to <code>UNSIGNED_BYTE</code> and the type
* of an element in <code>Uint8Array</code>.
*
* @type {Enumeration}
* @constant
* @default 0x1401
*/
UNSIGNED_BYTE : new Enumeration(0x1401, 'UNSIGNED_BYTE', {
sizeInBytes : Uint8Array.BYTES_PER_ELEMENT
}),
/**
* 16-bit unsigned short enumeration corresponding to <code>UNSIGNED_SHORT</code> and the type
* of an element in <code>Uint16Array</code>.
*
* @type {Enumeration}
* @constant
* @default 0x1403
*/
UNSIGNED_SHORT : new Enumeration(0x1403, 'UNSIGNED_SHORT', {
sizeInBytes : Uint16Array.BYTES_PER_ELEMENT
}),
/**
* 32-bit unsigned int enumeration corresponding to <code>UNSIGNED_INT</code> and the type
* of an element in <code>Uint32Array</code>.
*
* @type {Enumeration}
* @constant
* @default 0x1405
*/
UNSIGNED_INT : new Enumeration(0x1405, 'UNSIGNED_INT', {
sizeInBytes : Uint32Array.BYTES_PER_ELEMENT
})
};
/**
* Validates that the provided index datatype is a valid {@link IndexDatatype}.
*
* @param {IndexDatatype} indexDatatype The index datatype to validate.
*
* @returns {Boolean} <code>true</code> if the provided index datatype is a valid enumeration value; otherwise, <code>false</code>.
*
* @example
* if (!IndexDatatype.validate(indexDatatype)) {
* throw new DeveloperError('indexDatatype must be a valid enumeration value.');
* }
*/
IndexDatatype.validate = function(indexDatatype) {
return defined(indexDatatype) && defined(indexDatatype.value) &&
(indexDatatype.value === IndexDatatype.UNSIGNED_BYTE.value ||
indexDatatype.value === IndexDatatype.UNSIGNED_SHORT.value ||
indexDatatype.value === IndexDatatype.UNSIGNED_INT.value);
};
/**
* Creates a typed array that will store indices, using either <code><Uint16Array</code>
* or <code>Uint32Array</code> depending on the number of vertices.
*
* @param {Number} numberOfVertices Number of vertices that the indices will reference.
* @param {Any} indicesLengthOrArray Passed through to the typed array constructor.
*
* @returns {Array} A <code>Uint16Array</code> or <code>Uint32Array</code> constructed with <code>indicesLengthOrArray</code>.
*
* @exception {DeveloperError} center is required.
*
* @example
* this.indices = IndexDatatype.createTypedArray(positions.length / 3, numberOfIndices);
*/
IndexDatatype.createTypedArray = function(numberOfVertices, indicesLengthOrArray) {
if (!defined(numberOfVertices)) {
throw new DeveloperError('numberOfVertices is required.');
}
if (numberOfVertices > CesiumMath.SIXTY_FOUR_KILOBYTES) {
return new Uint32Array(indicesLengthOrArray);
}
return new Uint16Array(indicesLengthOrArray);
};
return IndexDatatype;
});
/*global define*/
define('Core/Tipsify',[
'./defaultValue',
'./defined',
'./DeveloperError'
], function(
defaultValue,
defined,
DeveloperError) {
"use strict";
/**
* Encapsulates an algorithm to optimize triangles for the post
* vertex-shader cache. This is based on the 2007 SIGGRAPH paper
* 'Fast Triangle Reordering for Vertex Locality and Reduced Overdraw.'
* The runtime is linear but several passes are made.
*
* @exports Tipsify
*
* @see <a href='http://gfx.cs.princeton.edu/pubs/Sander_2007_%3ETR/tipsy.pdf'>
* Fast Triangle Reordering for Vertex Locality and Reduced Overdraw</a>
* by Sander, Nehab, and Barczak
*/
var Tipsify = {};
/**
* Calculates the average cache miss ratio (ACMR) for a given set of indices.
*
* @param {Array} description.indices Lists triads of numbers corresponding to the indices of the vertices
* in the vertex buffer that define the geometry's triangles.
* @param {Number} [description.maximumIndex] The maximum value of the elements in <code>args.indices</code>.
* If not supplied, this value will be computed.
* @param {Number} [description.cacheSize=24] The number of vertices that can be stored in the cache at any one time.
*
* @exception {DeveloperError} indices is required.
* @exception {DeveloperError} indices length must be a multiple of three.
* @exception {DeveloperError} cacheSize must be greater than two.
*
* @returns {Number} The average cache miss ratio (ACMR).
*
* @example
* var indices = [0, 1, 2, 3, 4, 5];
* var maxIndex = 5;
* var cacheSize = 3;
* var acmr = Tipsify.calculateACMR({indices : indices, maxIndex : maxIndex, cacheSize : cacheSize});
*/
Tipsify.calculateACMR = function(description) {
description = defaultValue(description, defaultValue.EMPTY_OBJECT);
var indices = description.indices;
var maximumIndex = description.maximumIndex;
var cacheSize = defaultValue(description.cacheSize, 24);
if (!defined(indices)) {
throw new DeveloperError('indices is required.');
}
var numIndices = indices.length;
if (numIndices < 3 || numIndices % 3 !== 0) {
throw new DeveloperError('indices length must be a multiple of three.');
}
if (maximumIndex <= 0) {
throw new DeveloperError('maximumIndex must be greater than zero.');
}
if (cacheSize < 3) {
throw new DeveloperError('cacheSize must be greater than two.');
}
// Compute the maximumIndex if not given
if (!defined(maximumIndex)) {
maximumIndex = 0;
var currentIndex = 0;
var intoIndices = indices[currentIndex];
while (currentIndex < numIndices) {
if (intoIndices > maximumIndex) {
maximumIndex = intoIndices;
}
++currentIndex;
intoIndices = indices[currentIndex];
}
}
// Vertex time stamps
var vertexTimeStamps = [];
for ( var i = 0; i < maximumIndex + 1; i++) {
vertexTimeStamps[i] = 0;
}
// Cache processing
var s = cacheSize + 1;
for ( var j = 0; j < numIndices; ++j) {
if ((s - vertexTimeStamps[indices[j]]) > cacheSize) {
vertexTimeStamps[indices[j]] = s;
++s;
}
}
return (s - cacheSize + 1) / (numIndices / 3);
};
/**
* Optimizes triangles for the post-vertex shader cache.
*
* @param {Array} description.indices Lists triads of numbers corresponding to the indices of the vertices
* in the vertex buffer that define the geometry's triangles.
* @param {Number} [description.maximumIndex] The maximum value of the elements in <code>args.indices</code>.
* If not supplied, this value will be computed.
* @param {Number} [description.cacheSize=24] The number of vertices that can be stored in the cache at any one time.
*
* @exception {DeveloperError} indices is required.
* @exception {DeveloperError} indices length must be a multiple of three.
* @exception {DeveloperError} cacheSize must be greater than two.
*
* @returns {Array} A list of the input indices in an optimized order.
*
* @example
* var indices = [0, 1, 2, 3, 4, 5];
* var maxIndex = 5;
* var cacheSize = 3;
* var reorderedIndices = Tipsify.tipsify({indices : indices, maxIndex : maxIndex, cacheSize : cacheSize});
*/
Tipsify.tipsify = function(description) {
description = defaultValue(description, defaultValue.EMPTY_OBJECT);
var indices = description.indices;
var maximumIndex = description.maximumIndex;
var cacheSize = defaultValue(description.cacheSize, 24);
var cursor;
function skipDeadEnd(vertices, deadEnd, indices, maximumIndexPlusOne) {
while (deadEnd.length >= 1) {
// while the stack is not empty
var d = deadEnd[deadEnd.length - 1]; // top of the stack
deadEnd.splice(deadEnd.length - 1, 1); // pop the stack
if (vertices[d].numLiveTriangles > 0) {
return d;
}
}
while (cursor < maximumIndexPlusOne) {
if (vertices[cursor].numLiveTriangles > 0) {
++cursor;
return cursor - 1;
}
++cursor;
}
return -1;
}
function getNextVertex(indices, cacheSize, oneRing, vertices, s, deadEnd, maximumIndexPlusOne) {
var n = -1;
var p;
var m = -1;
var itOneRing = 0;
while (itOneRing < oneRing.length) {
var index = oneRing[itOneRing];
if (vertices[index].numLiveTriangles) {
p = 0;
if ((s - vertices[index].timeStamp + (2 * vertices[index].numLiveTriangles)) <= cacheSize) {
p = s - vertices[index].timeStamp;
}
if ((p > m) || (m === -1)) {
m = p;
n = index;
}
}
++itOneRing;
}
if (n === -1) {
return skipDeadEnd(vertices, deadEnd, indices, maximumIndexPlusOne);
}
return n;
}
if (!defined(indices)) {
throw new DeveloperError('indices is required.');
}
var numIndices = indices.length;
if (numIndices < 3 || numIndices % 3 !== 0) {
throw new DeveloperError('indices length must be a multiple of three.');
}
if (maximumIndex <= 0) {
throw new DeveloperError('maximumIndex must be greater than zero.');
}
if (cacheSize < 3) {
throw new DeveloperError('cacheSize must be greater than two.');
}
// Determine maximum index
var maximumIndexPlusOne = 0;
var currentIndex = 0;
var intoIndices = indices[currentIndex];
var endIndex = numIndices;
if (defined(maximumIndex)) {
maximumIndexPlusOne = maximumIndex + 1;
} else {
while (currentIndex < endIndex) {
if (intoIndices > maximumIndexPlusOne) {
maximumIndexPlusOne = intoIndices;
}
++currentIndex;
intoIndices = indices[currentIndex];
}
if (maximumIndexPlusOne === -1) {
return 0;
}
++maximumIndexPlusOne;
}
// Vertices
var vertices = [];
for ( var i = 0; i < maximumIndexPlusOne; i++) {
vertices[i] = {
numLiveTriangles : 0,
timeStamp : 0,
vertexTriangles : []
};
}
currentIndex = 0;
var triangle = 0;
while (currentIndex < endIndex) {
vertices[indices[currentIndex]].vertexTriangles.push(triangle);
++(vertices[indices[currentIndex]]).numLiveTriangles;
vertices[indices[currentIndex + 1]].vertexTriangles.push(triangle);
++(vertices[indices[currentIndex + 1]]).numLiveTriangles;
vertices[indices[currentIndex + 2]].vertexTriangles.push(triangle);
++(vertices[indices[currentIndex + 2]]).numLiveTriangles;
++triangle;
currentIndex += 3;
}
// Starting index
var f = 0;
// Time Stamp
var s = cacheSize + 1;
cursor = 1;
// Process
var oneRing = [];
var deadEnd = []; //Stack
var vertex;
var intoVertices;
var currentOutputIndex = 0;
var outputIndices = [];
var numTriangles = numIndices / 3;
var triangleEmitted = [];
for (i = 0; i < numTriangles; i++) {
triangleEmitted[i] = false;
}
var index;
var limit;
while (f !== -1) {
oneRing = [];
intoVertices = vertices[f];
limit = intoVertices.vertexTriangles.length;
for ( var k = 0; k < limit; ++k) {
triangle = intoVertices.vertexTriangles[k];
if (!triangleEmitted[triangle]) {
triangleEmitted[triangle] = true;
currentIndex = triangle + triangle + triangle;
for ( var j = 0; j < 3; ++j) {
// Set this index as a possible next index
index = indices[currentIndex];
oneRing.push(index);
deadEnd.push(index);
// Output index
outputIndices[currentOutputIndex] = index;
++currentOutputIndex;
// Cache processing
vertex = vertices[index];
--vertex.numLiveTriangles;
if ((s - vertex.timeStamp) > cacheSize) {
vertex.timeStamp = s;
++s;
}
++currentIndex;
}
}
}
f = getNextVertex(indices, cacheSize, oneRing, vertices, s, deadEnd, maximumIndexPlusOne);
}
return outputIndices;
};
return Tipsify;
});
/*global define*/
define('Core/GeometryPipeline',[
'./barycentricCoordinates',
'./defaultValue',
'./defined',
'./DeveloperError',
'./Cartesian2',
'./Cartesian3',
'./Cartesian4',
'./Cartographic',
'./EncodedCartesian3',
'./Intersect',
'./IntersectionTests',
'./Math',
'./Matrix3',
'./Matrix4',
'./Plane',
'./GeographicProjection',
'./ComponentDatatype',
'./IndexDatatype',
'./PrimitiveType',
'./Tipsify',
'./BoundingSphere',
'./Geometry',
'./GeometryAttribute'
], function(
barycentricCoordinates,
defaultValue,
defined,
DeveloperError,
Cartesian2,
Cartesian3,
Cartesian4,
Cartographic,
EncodedCartesian3,
Intersect,
IntersectionTests,
CesiumMath,
Matrix3,
Matrix4,
Plane,
GeographicProjection,
ComponentDatatype,
IndexDatatype,
PrimitiveType,
Tipsify,
BoundingSphere,
Geometry,
GeometryAttribute) {
"use strict";
/**
* Content pipeline functions for geometries.
*
* @exports GeometryPipeline
*
* @see Geometry
* @see Context#createVertexArrayFromGeometry
*/
var GeometryPipeline = {};
function addTriangle(lines, index, i0, i1, i2) {
lines[index++] = i0;
lines[index++] = i1;
lines[index++] = i1;
lines[index++] = i2;
lines[index++] = i2;
lines[index] = i0;
}
function trianglesToLines(triangles) {
var count = triangles.length;
var size = (count / 3) * 6;
var lines = IndexDatatype.createTypedArray(count, size);
var index = 0;
for ( var i = 0; i < count; i += 3, index += 6) {
addTriangle(lines, index, triangles[i], triangles[i + 1], triangles[i + 2]);
}
return lines;
}
function triangleStripToLines(triangles) {
var count = triangles.length;
if (count >= 3) {
var size = (count - 2) * 6;
var lines = IndexDatatype.createTypedArray(count, size);
addTriangle(lines, 0, triangles[0], triangles[1], triangles[2]);
var index = 6;
for ( var i = 3; i < count; ++i, index += 6) {
addTriangle(lines, index, triangles[i - 1], triangles[i], triangles[i - 2]);
}
return lines;
}
return new Uint16Array();
}
function triangleFanToLines(triangles) {
if (triangles.length > 0) {
var count = triangles.length - 1;
var size = (count - 1) * 6;
var lines = IndexDatatype.createTypedArray(count, size);
var base = triangles[0];
var index = 0;
for ( var i = 1; i < count; ++i, index += 6) {
addTriangle(lines, index, base, triangles[i], triangles[i + 1]);
}
return lines;
}
return new Uint16Array();
}
/**
* Converts a geometry's triangle indices to line indices. If the geometry has an <code>indices</code>
* and its <code>primitiveType</code> is <code>TRIANGLES</code>, <code>TRIANGLE_STRIP</code>,
* <code>TRIANGLE_FAN</code>, it is converted to <code>LINES</code>; otherwise, the geometry is not changed.
* <p>
* This is commonly used to create a wireframe geometry for visual debugging.
* </p>
*
* @param {Geometry} geometry The geometry to modify.
*
* @returns {Geometry} The modified <code>geometry</code> argument, with its triangle indices converted to lines.
*
* @exception {DeveloperError} geometry is required.
* @exception {DeveloperError} geometry.primitiveType must be TRIANGLES, TRIANGLE_STRIP, or TRIANGLE_FAN.
*
* @example
* geometry = GeometryPipeline.toWireframe(geometry);
*/
GeometryPipeline.toWireframe = function(geometry) {
if (!defined(geometry)) {
throw new DeveloperError('geometry is required.');
}
var indices = geometry.indices;
if (defined(indices)) {
switch (geometry.primitiveType.value) {
case PrimitiveType.TRIANGLES.value:
geometry.indices = trianglesToLines(indices);
break;
case PrimitiveType.TRIANGLE_STRIP.value:
geometry.indices = triangleStripToLines(indices);
break;
case PrimitiveType.TRIANGLE_FAN.value:
geometry.indices = triangleFanToLines(indices);
break;
default:
throw new DeveloperError('geometry.primitiveType must be TRIANGLES, TRIANGLE_STRIP, or TRIANGLE_FAN.');
}
geometry.primitiveType = PrimitiveType.LINES;
}
return geometry;
};
/**
* Creates a new {@link Geometry} with <code>LINES</code> representing the provided
* attribute (<code>attributeName</code>) for the provided geometry. This is used to
* visualize vector attributes like normals, binormals, and tangents.
*
* @param {Geometry} geometry The <code>Geometry</code> instance with the attribute.
* @param {String} [attributeName='normal'] The name of the attribute.
* @param {Number} [length=10000.0] The length of each line segment in meters. This can be negative to point the vector in the opposite direction.
*
* @returns {Geometry} A new <code>Geometry<code> instance with line segments for the vector.
*
* @exception {DeveloperError} geometry is required.
* @exception {DeveloperError} geometry.attributes.position is required.
* @exception {DeveloperError} geometry.attributes must have an attribute with the same name as the attributeName parameter.
*
* @example
* var geometry = GeometryPipeline.createLineSegmentsForVectors(instance.geometry, 'binormal', 100000.0),
*/
GeometryPipeline.createLineSegmentsForVectors = function(geometry, attributeName, length) {
if (!defined(geometry)) {
throw new DeveloperError('geometry is required.');
}
if (!defined(geometry.attributes.position)) {
throw new DeveloperError('geometry.attributes.position is required.');
}
attributeName = defaultValue(attributeName, 'normal');
if (!defined(geometry.attributes[attributeName])) {
throw new DeveloperError('geometry.attributes must have an attribute with the same name as the attributeName parameter, ' + attributeName + '.');
}
length = defaultValue(length, 10000.0);
var positions = geometry.attributes.position.values;
var vectors = geometry.attributes[attributeName].values;
var positionsLength = positions.length;
var newPositions = new Float64Array(2 * positionsLength);
var j = 0;
for (var i = 0; i < positionsLength; i += 3) {
newPositions[j++] = positions[i];
newPositions[j++] = positions[i + 1];
newPositions[j++] = positions[i + 2];
newPositions[j++] = positions[i] + (vectors[i] * length);
newPositions[j++] = positions[i + 1] + (vectors[i + 1] * length);
newPositions[j++] = positions[i + 2] + (vectors[i + 2] * length);
}
var newBoundingSphere;
var bs = geometry.boundingSphere;
if (defined(bs)) {
newBoundingSphere = new BoundingSphere(bs.center, bs.radius + length);
}
return new Geometry({
attributes : {
position : new GeometryAttribute({
componentDatatype : ComponentDatatype.DOUBLE,
componentsPerAttribute : 3,
values : newPositions
})
},
primitiveType : PrimitiveType.LINES,
boundingSphere : newBoundingSphere
});
};
/**
* Creates an object that maps attribute names to unique indices for matching
* vertex attributes and shader programs.
*
* @param {Geometry} geometry The geometry, which is not modified, to create the object for.
*
* @returns {Object} An object with attribute name / index pairs.
*
* @exception {DeveloperError} geometry is required.
*
* @example
* var attributeIndices = GeometryPipeline.createAttributeIndices(geometry);
* // Example output
* // {
* // 'position' : 0,
* // 'normal' : 1
* // }
*
* @see Context#createVertexArrayFromGeometry
* @see ShaderCache
*/
GeometryPipeline.createAttributeIndices = function(geometry) {
if (!defined(geometry)) {
throw new DeveloperError('geometry is required.');
}
// There can be a WebGL performance hit when attribute 0 is disabled, so
// assign attribute locations to well-known attributes.
var semantics = [
'position',
'positionHigh',
'positionLow',
// From VertexFormat.position - after 2D projection and high-precision encoding
'position3DHigh',
'position3DLow',
'position2DHigh',
'position2DLow',
// From Primitive
'pickColor',
// From VertexFormat
'normal',
'st',
'binormal',
'tangent'
];
var attributes = geometry.attributes;
var indices = {};
var j = 0;
var i;
var len = semantics.length;
// Attribute locations for well-known attributes
for (i = 0; i < len; ++i) {
var semantic = semantics[i];
if (defined(attributes[semantic])) {
indices[semantic] = j++;
}
}
// Locations for custom attributes
for (var name in attributes) {
if (attributes.hasOwnProperty(name) && (!defined(indices[name]))) {
indices[name] = j++;
}
}
return indices;
};
/**
* Reorders a geometry's attributes and <code>indices</code> to achieve better performance from the GPU's pre-vertex-shader cache.
*
* @param {Geometry} geometry The geometry to modify.
*
* @returns {Geometry} The modified <code>geometry</code> argument, with its attributes and indices reordered for the GPU's pre-vertex-shader cache.
*
* @exception {DeveloperError} geometry is required.
* @exception {DeveloperError} Each attribute array in geometry.attributes must have the same number of attributes.
*
* @example
* geometry = GeometryPipeline.reorderForPreVertexCache(geometry);
*
* @see GeometryPipeline.reorderForPostVertexCache
*/
GeometryPipeline.reorderForPreVertexCache = function(geometry) {
if (!defined(geometry)) {
throw new DeveloperError('geometry is required.');
}
var numVertices = Geometry.computeNumberOfVertices(geometry);
var indices = geometry.indices;
if (defined(indices)) {
var indexCrossReferenceOldToNew = new Int32Array(numVertices);
for ( var i = 0; i < numVertices; i++) {
indexCrossReferenceOldToNew[i] = -1;
}
// Construct cross reference and reorder indices
var indicesIn = indices;
var numIndices = indicesIn.length;
var indicesOut = IndexDatatype.createTypedArray(numVertices, numIndices);
var intoIndicesIn = 0;
var intoIndicesOut = 0;
var nextIndex = 0;
var tempIndex;
while (intoIndicesIn < numIndices) {
tempIndex = indexCrossReferenceOldToNew[indicesIn[intoIndicesIn]];
if (tempIndex !== -1) {
indicesOut[intoIndicesOut] = tempIndex;
} else {
tempIndex = indicesIn[intoIndicesIn];
indexCrossReferenceOldToNew[tempIndex] = nextIndex;
indicesOut[intoIndicesOut] = nextIndex;
++nextIndex;
}
++intoIndicesIn;
++intoIndicesOut;
}
geometry.indices = indicesOut;
// Reorder attributes
var attributes = geometry.attributes;
for ( var property in attributes) {
if (attributes.hasOwnProperty(property) &&
defined(attributes[property]) &&
defined(attributes[property].values)) {
var attribute = attributes[property];
var elementsIn = attribute.values;
var intoElementsIn = 0;
var numComponents = attribute.componentsPerAttribute;
var elementsOut = ComponentDatatype.createTypedArray(attribute.componentDatatype, elementsIn.length);
while (intoElementsIn < numVertices) {
var temp = indexCrossReferenceOldToNew[intoElementsIn];
for (i = 0; i < numComponents; i++) {
elementsOut[numComponents * temp + i] = elementsIn[numComponents * intoElementsIn + i];
}
++intoElementsIn;
}
attribute.values = elementsOut;
}
}
}
return geometry;
};
/**
* Reorders a geometry's <code>indices</code> to achieve better performance from the GPU's
* post vertex-shader cache by using the Tipsify algorithm. If the geometry <code>primitiveType</code>
* is not <code>TRIANGLES</code> or the geometry does not have an <code>indices</code>, this function has no effect.
*
* @param {Geometry} geometry The geometry to modify.
* @param {Number} [cacheCapacity=24] The number of vertices that can be held in the GPU's vertex cache.
*
* @returns {Geometry} The modified <code>geometry</code> argument, with its indices reordered for the post-vertex-shader cache.
*
* @exception {DeveloperError} geometry is required.
* @exception {DeveloperError} cacheCapacity must be greater than two.
*
* @example
* geometry = GeometryPipeline.reorderForPostVertexCache(geometry);
*
* @see GeometryPipeline.reorderForPreVertexCache
* @see <a href='http://gfx.cs.princeton.edu/pubs/Sander_2007_%3ETR/tipsy.pdf'>
* Fast Triangle Reordering for Vertex Locality and Reduced Overdraw</a>
* by Sander, Nehab, and Barczak
*/
GeometryPipeline.reorderForPostVertexCache = function(geometry, cacheCapacity) {
if (!defined(geometry)) {
throw new DeveloperError('geometry is required.');
}
var indices = geometry.indices;
if ((geometry.primitiveType.value === PrimitiveType.TRIANGLES.value) && (defined(indices))) {
var numIndices = indices.length;
var maximumIndex = 0;
for ( var j = 0; j < numIndices; j++) {
if (indices[j] > maximumIndex) {
maximumIndex = indices[j];
}
}
geometry.indices = Tipsify.tipsify({
indices : indices,
maximumIndex : maximumIndex,
cacheSize : cacheCapacity
});
}
return geometry;
};
function copyAttributesDescriptions(attributes) {
var newAttributes = {};
for ( var attribute in attributes) {
if (attributes.hasOwnProperty(attribute) &&
defined(attributes[attribute]) &&
defined(attributes[attribute].values)) {
var attr = attributes[attribute];
newAttributes[attribute] = new GeometryAttribute({
componentDatatype : attr.componentDatatype,
componentsPerAttribute : attr.componentsPerAttribute,
normalize : attr.normalize,
values : []
});
}
}
return newAttributes;
}
function copyVertex(destinationAttributes, sourceAttributes, index) {
for ( var attribute in sourceAttributes) {
if (sourceAttributes.hasOwnProperty(attribute) &&
defined(sourceAttributes[attribute]) &&
defined(sourceAttributes[attribute].values)) {
var attr = sourceAttributes[attribute];
for ( var k = 0; k < attr.componentsPerAttribute; ++k) {
destinationAttributes[attribute].values.push(attr.values[(index * attr.componentsPerAttribute) + k]);
}
}
}
}
/**
* Splits a geometry into multiple geometries, if necessary, to ensure that indices in the
* <code>indices</code> fit into unsigned shorts. This is used to meet the WebGL requirements
* when {@link Context#getElementIndexUint} is <code>false</code>.
* <p>
* If the geometry does not have any <code>indices</code>, this function has no effect.
* </p>
*
* @param {Geometry} geometry The geometry to be split into multiple geometries.
*
* @returns {Array} An array of geometries, each with indices that fit into unsigned shorts.
*
* @exception {DeveloperError} geometry is required.
* @exception {DeveloperError} geometry.primitiveType must equal to PrimitiveType.TRIANGLES, PrimitiveType.LINES, or PrimitiveType.POINTS
* @exception {DeveloperError} All geometry attribute lists must have the same number of attributes.
*
* @example
* var geometries = GeometryPipeline.fitToUnsignedShortIndices(geometry);
*/
GeometryPipeline.fitToUnsignedShortIndices = function(geometry) {
if (!defined(geometry)) {
throw new DeveloperError('geometry is required.');
}
if ((defined(geometry.indices)) &&
((geometry.primitiveType.value !== PrimitiveType.TRIANGLES.value) &&
(geometry.primitiveType.value !== PrimitiveType.LINES.value) &&
(geometry.primitiveType.value !== PrimitiveType.POINTS.value))) {
throw new DeveloperError('geometry.primitiveType must equal to PrimitiveType.TRIANGLES, PrimitiveType.LINES, or PrimitiveType.POINTS.');
}
var geometries = [];
// If there's an index list and more than 64K attributes, it is possible that
// some indices are outside the range of unsigned short [0, 64K - 1]
var numberOfVertices = Geometry.computeNumberOfVertices(geometry);
if (defined(geometry.indices) && (numberOfVertices > CesiumMath.SIXTY_FOUR_KILOBYTES)) {
var oldToNewIndex = [];
var newIndices = [];
var currentIndex = 0;
var newAttributes = copyAttributesDescriptions(geometry.attributes);
var originalIndices = geometry.indices;
var numberOfIndices = originalIndices.length;
var indicesPerPrimitive;
if (geometry.primitiveType.value === PrimitiveType.TRIANGLES.value) {
indicesPerPrimitive = 3;
} else if (geometry.primitiveType.value === PrimitiveType.LINES.value) {
indicesPerPrimitive = 2;
} else if (geometry.primitiveType.value === PrimitiveType.POINTS.value) {
indicesPerPrimitive = 1;
}
for ( var j = 0; j < numberOfIndices; j += indicesPerPrimitive) {
for (var k = 0; k < indicesPerPrimitive; ++k) {
var x = originalIndices[j + k];
var i = oldToNewIndex[x];
if (!defined(i)) {
i = currentIndex++;
oldToNewIndex[x] = i;
copyVertex(newAttributes, geometry.attributes, x);
}
newIndices.push(i);
}
if (currentIndex + indicesPerPrimitive > CesiumMath.SIXTY_FOUR_KILOBYTES) {
geometries.push(new Geometry({
attributes : newAttributes,
indices : newIndices,
primitiveType : geometry.primitiveType,
boundingSphere : geometry.boundingSphere
}));
// Reset for next vertex-array
oldToNewIndex = [];
newIndices = [];
currentIndex = 0;
newAttributes = copyAttributesDescriptions(geometry.attributes);
}
}
if (newIndices.length !== 0) {
geometries.push(new Geometry({
attributes : newAttributes,
indices : newIndices,
primitiveType : geometry.primitiveType,
boundingSphere : geometry.boundingSphere
}));
}
} else {
// No need to split into multiple geometries
geometries.push(geometry);
}
return geometries;
};
var scratchProjectTo2DCartesian3 = new Cartesian3();
var scratchProjectTo2DCartographic = new Cartographic();
/**
* Projects a geometry's 3D <code>position</code> attribute to 2D, replacing the <code>position</code>
* attribute with separate <code>position3D</code> and <code>position2D</code> attributes.
* <p>
* If the geometry does not have a <code>position</code>, this function has no effect.
* </p>
*
* @param {Geometry} geometry The geometry to modify.
* @param {String} attributeName The name of the attribute.
* @param {String} attributeName3D The name of the attribute in 3D.
* @param {String} attributeName2D The name of the attribute in 2D.
* @param {Object} [projection=new GeographicProjection()] The projection to use.
*
* @returns {Geometry} The modified <code>geometry</code> argument with <code>position3D</code> and <code>position2D</code> attributes.
*
* @exception {DeveloperError} geometry is required.
* @exception {DeveloperError} attributeName is required.
* @exception {DeveloperError} attributeName3D is required.
* @exception {DeveloperError} attributeName2D is required.
* @exception {DeveloperError} geometry must have attribute matching the attributeName argument.
* @exception {DeveloperError} The attribute componentDatatype must be ComponentDatatype.DOUBLE.
*
* @example
* geometry = GeometryPipeline.projectTo2D(geometry, 'position', 'position3D', 'position2D');
*/
GeometryPipeline.projectTo2D = function(geometry, attributeName, attributeName3D, attributeName2D, projection) {
if (!defined(geometry)) {
throw new DeveloperError('geometry is required.');
}
if (!defined(attributeName)) {
throw new DeveloperError('attributeName is required.');
}
if (!defined(attributeName3D)) {
throw new DeveloperError('attributeName3D is required.');
}
if (!defined(attributeName2D)) {
throw new DeveloperError('attributeName2D is required.');
}
var attribute = geometry.attributes[attributeName];
if (!defined(attribute)) {
throw new DeveloperError('geometry must have attribute matching the attributeName argument: ' + attributeName + '.');
}
if (attribute.componentDatatype.value !== ComponentDatatype.DOUBLE.value) {
throw new DeveloperError('The attribute componentDatatype must be ComponentDatatype.DOUBLE.');
}
projection = (defined(projection)) ? projection : new GeographicProjection();
var ellipsoid = projection.getEllipsoid();
// Project original values to 2D.
var values3D = attribute.values;
var projectedValues = new Float64Array(values3D.length);
var index = 0;
for ( var i = 0; i < values3D.length; i += 3) {
var value = Cartesian3.fromArray(values3D, i, scratchProjectTo2DCartesian3);
if (Cartesian3.equals(value, Cartesian3.ZERO)) {
continue;
}
var lonLat = ellipsoid.cartesianToCartographic(value, scratchProjectTo2DCartographic);
var projectedLonLat = projection.project(lonLat, scratchProjectTo2DCartesian3);
projectedValues[index++] = projectedLonLat.x;
projectedValues[index++] = projectedLonLat.y;
projectedValues[index++] = projectedLonLat.z;
}
// Rename original cartesians to WGS84 cartesians.
geometry.attributes[attributeName3D] = attribute;
// Replace original cartesians with 2D projected cartesians
geometry.attributes[attributeName2D] = new GeometryAttribute({
componentDatatype : ComponentDatatype.DOUBLE,
componentsPerAttribute : 3,
values : projectedValues
});
delete geometry.attributes[attributeName];
return geometry;
};
var encodedResult = {
high : 0.0,
low : 0.0
};
/**
* Encodes floating-point geometry attribute values as two separate attributes to improve
* rendering precision using the same encoding as {@link EncodedCartesian3}.
* <p>
* This is commonly used to create high-precision position vertex attributes.
* </p>
*
* @param {Geometry} geometry The geometry to modify.
* @param {String} attributeName The name of the attribute.
* @param {String} attributeHighName The name of the attribute for the encoded high bits.
* @param {String} attributeLowName The name of the attribute for the encoded low bits.
*
* @returns {Geometry} The modified <code>geometry</code> argument, with its encoded attribute.
*
* @exception {DeveloperError} geometry is required.
* @exception {DeveloperError} attributeName is required.
* @exception {DeveloperError} attributeHighName is required.
* @exception {DeveloperError} attributeLowName is required.
* @exception {DeveloperError} geometry must have attribute matching the attributeName argument.
* @exception {DeveloperError} The attribute componentDatatype must be ComponentDatatype.DOUBLE.
*
* @example
* geometry = GeometryPipeline.encodeAttribute(geometry, 'position3D', 'position3DHigh', 'position3DLow');
*
* @see EncodedCartesian3
*/
GeometryPipeline.encodeAttribute = function(geometry, attributeName, attributeHighName, attributeLowName) {
if (!defined(geometry)) {
throw new DeveloperError('geometry is required.');
}
if (!defined(attributeName)) {
throw new DeveloperError('attributeName is required.');
}
if (!defined(attributeHighName)) {
throw new DeveloperError('attributeHighName is required.');
}
if (!defined(attributeLowName)) {
throw new DeveloperError('attributeLowName is required.');
}
var attribute = geometry.attributes[attributeName];
if (!defined(attribute)) {
throw new DeveloperError('geometry must have attribute matching the attributeName argument: ' + attributeName + '.');
}
if (attribute.componentDatatype.value !== ComponentDatatype.DOUBLE.value) {
throw new DeveloperError('The attribute componentDatatype must be ComponentDatatype.DOUBLE.');
}
var values = attribute.values;
var length = values.length;
var highValues = new Float32Array(length);
var lowValues = new Float32Array(length);
for (var i = 0; i < length; ++i) {
EncodedCartesian3.encode(values[i], encodedResult);
highValues[i] = encodedResult.high;
lowValues[i] = encodedResult.low;
}
var componentsPerAttribute = attribute.componentsPerAttribute;
geometry.attributes[attributeHighName] = new GeometryAttribute({
componentDatatype : ComponentDatatype.FLOAT,
componentsPerAttribute : componentsPerAttribute,
values : highValues
});
geometry.attributes[attributeLowName] = new GeometryAttribute({
componentDatatype : ComponentDatatype.FLOAT,
componentsPerAttribute : componentsPerAttribute,
values : lowValues
});
delete geometry.attributes[attributeName];
return geometry;
};
var scratchCartesian3 = new Cartesian3();
var scratchCartesian4 = new Cartesian4();
function transformPoint(matrix, attribute) {
if (defined(attribute)) {
var values = attribute.values;
var length = values.length;
for (var i = 0; i < length; i += 3) {
Cartesian3.unpack(values, i, scratchCartesian3);
Matrix4.multiplyByPoint(matrix, scratchCartesian3, scratchCartesian4);
Cartesian3.pack(scratchCartesian4, values, i);
}
}
}
function transformVector(matrix, attribute) {
if (defined(attribute)) {
var values = attribute.values;
var length = values.length;
for (var i = 0; i < length; i += 3) {
Cartesian3.unpack(values, i, scratchCartesian3);
Matrix3.multiplyByVector(matrix, scratchCartesian3, scratchCartesian4);
Cartesian3.pack(scratchCartesian4, values, i);
}
}
}
var inverseTranspose = new Matrix4();
var normalMatrix = new Matrix3();
/**
* Transforms a geometry instance to world coordinates. This is used as a prerequisite
* to batch together several instances with {@link GeometryPipeline.combine}. This changes
* the instance's <code>modelMatrix</code> to {@see Matrix4.IDENTITY} and transforms the
* following attributes if they are present: <code>position</code>, <code>normal</code>,
* <code>binormal</code>, and <code>tangent</code>.
*
* @param {GeometryInstance} instance The geometry instance to modify.
*
* @returns {GeometryInstance} The modified <code>instance</code> argument, with its attributes transforms to world coordinates.
*
* @exception {DeveloperError} instance is required.
*
* @example
* for (var i = 0; i < instances.length; ++i) {
* GeometryPipeline.transformToWorldCoordinates(instances[i]);
* }
* var geometry = GeometryPipeline.combine(instances);
*
* @see GeometryPipeline.combine
*/
GeometryPipeline.transformToWorldCoordinates = function(instance) {
if (!defined(instance)) {
throw new DeveloperError('instance is required.');
}
var modelMatrix = instance.modelMatrix;
if (Matrix4.equals(modelMatrix, Matrix4.IDENTITY)) {
// Already in world coordinates
return instance;
}
var attributes = instance.geometry.attributes;
// Transform attributes in known vertex formats
transformPoint(modelMatrix, attributes.position);
if ((defined(attributes.normal)) ||
(defined(attributes.binormal)) ||
(defined(attributes.tangent))) {
Matrix4.inverse(modelMatrix, inverseTranspose);
Matrix4.transpose(inverseTranspose, inverseTranspose);
Matrix4.getRotation(inverseTranspose, normalMatrix);
transformVector(normalMatrix, attributes.normal);
transformVector(normalMatrix, attributes.binormal);
transformVector(normalMatrix, attributes.tangent);
}
var boundingSphere = instance.geometry.boundingSphere;
if (defined(boundingSphere)) {
Matrix4.multiplyByPoint(modelMatrix, boundingSphere.center, boundingSphere.center);
boundingSphere.center = Cartesian3.fromCartesian4(boundingSphere.center);
}
instance.modelMatrix = Matrix4.IDENTITY.clone();
return instance;
};
function findAttributesInAllGeometries(instances) {
var length = instances.length;
var attributesInAllGeometries = {};
var attributes0 = instances[0].geometry.attributes;
var name;
for (name in attributes0) {
if (attributes0.hasOwnProperty(name) &&
defined(attributes0[name]) &&
defined(attributes0[name].values)) {
var attribute = attributes0[name];
var numberOfComponents = attribute.values.length;
var inAllGeometries = true;
// Does this same attribute exist in all geometries?
for (var i = 1; i < length; ++i) {
var otherAttribute = instances[i].geometry.attributes[name];
if ((!defined(otherAttribute)) ||
(attribute.componentDatatype.value !== otherAttribute.componentDatatype.value) ||
(attribute.componentsPerAttribute !== otherAttribute.componentsPerAttribute) ||
(attribute.normalize !== otherAttribute.normalize)) {
inAllGeometries = false;
break;
}
numberOfComponents += otherAttribute.values.length;
}
if (inAllGeometries) {
attributesInAllGeometries[name] = new GeometryAttribute({
componentDatatype : attribute.componentDatatype,
componentsPerAttribute : attribute.componentsPerAttribute,
normalize : attribute.normalize,
values : ComponentDatatype.createTypedArray(attribute.componentDatatype, numberOfComponents)
});
}
}
}
return attributesInAllGeometries;
}
/**
* Combines geometry from several {@link GeometryInstance} objects into one geometry.
* This concatenates the attributes, concatenates and adjusts the indices, and creates
* a bounding sphere encompassing all instances.
* <p>
* If the instances do not have the same attributes, a subset of attributes common
* to all instances is used, and the others are ignored.
* </p>
* <p>
* This is used by {@link Primitive} to efficiently render a large amount of static data.
* </p>
*
* @param {Array} [instances] The array of {@link GeometryInstance} objects whose geometry will be combined.
*
* @returns {Geometry} A single geometry created from the provided geometry instances.
*
* @exception {DeveloperError} instances is required and must have length greater than zero.
* @exception {DeveloperError} All instances must have the same modelMatrix.
* @exception {DeveloperError} All instance geometries must have an indices or not have one.
* @exception {DeveloperError} All instance geometries must have the same primitiveType.
*
* @example
* for (var i = 0; i < instances.length; ++i) {
* GeometryPipeline.transformToWorldCoordinates(instances[i]);
* }
* var geometry = GeometryPipeline.combine(instances);
*
* @see GeometryPipeline.transformToWorldCoordinates
*/
GeometryPipeline.combine = function(instances) {
if ((!defined(instances)) || (instances.length < 1)) {
throw new DeveloperError('instances is required and must have length greater than zero.');
}
var length = instances.length;
var name;
var i;
var j;
var k;
var m = instances[0].modelMatrix;
var haveIndices = (defined(instances[0].geometry.indices));
var primitiveType = instances[0].geometry.primitiveType;
for (i = 1; i < length; ++i) {
if (!Matrix4.equals(instances[i].modelMatrix, m)) {
throw new DeveloperError('All instances must have the same modelMatrix.');
}
if ((defined(instances[i].geometry.indices)) !== haveIndices) {
throw new DeveloperError('All instance geometries must have an indices or not have one.');
}
if (instances[i].geometry.primitiveType.value !== primitiveType.value) {
throw new DeveloperError('All instance geometries must have the same primitiveType.');
}
}
// Find subset of attributes in all geometries
var attributes = findAttributesInAllGeometries(instances);
var values;
var sourceValues;
var sourceValuesLength;
// Combine attributes from each geometry into a single typed array
for (name in attributes) {
if (attributes.hasOwnProperty(name)) {
values = attributes[name].values;
k = 0;
for (i = 0; i < length; ++i) {
sourceValues = instances[i].geometry.attributes[name].values;
sourceValuesLength = sourceValues.length;
for (j = 0; j < sourceValuesLength; ++j) {
values[k++] = sourceValues[j];
}
}
}
}
// Combine index lists
var indices;
if (haveIndices) {
var numberOfIndices = 0;
for (i = 0; i < length; ++i) {
numberOfIndices += instances[i].geometry.indices.length;
}
var numberOfVertices = Geometry.computeNumberOfVertices(new Geometry({
attributes : attributes,
primitiveType : PrimitiveType.POINTS
}));
var destIndices = IndexDatatype.createTypedArray(numberOfVertices, numberOfIndices);
var destOffset = 0;
var offset = 0;
for (i = 0; i < length; ++i) {
var sourceIndices = instances[i].geometry.indices;
var sourceIndicesLen = sourceIndices.length;
for (k = 0; k < sourceIndicesLen; ++k) {
destIndices[destOffset++] = offset + sourceIndices[k];
}
offset += Geometry.computeNumberOfVertices(instances[i].geometry);
}
indices = destIndices;
}
// Create bounding sphere that includes all instances
var center = new Cartesian3();
var radius = 0.0;
var bs;
for (i = 0; i < length; ++i) {
bs = instances[i].geometry.boundingSphere;
if (!defined(bs)) {
// If any geometries have an undefined bounding sphere, then so does the combined geometry
center = undefined;
break;
}
Cartesian3.add(bs.center, center, center);
}
if (defined(center)) {
Cartesian3.divideByScalar(center, length, center);
for (i = 0; i < length; ++i) {
bs = instances[i].geometry.boundingSphere;
var tempRadius = Cartesian3.magnitude(Cartesian3.subtract(bs.center, center)) + bs.radius;
if (tempRadius > radius) {
radius = tempRadius;
}
}
}
return new Geometry({
attributes : attributes,
indices : indices,
primitiveType : primitiveType,
boundingSphere : (defined(center)) ? new BoundingSphere(center, radius) : undefined
});
};
var normal = new Cartesian3();
var v0 = new Cartesian3();
var v1 = new Cartesian3();
var v2 = new Cartesian3();
/**
* Computes per-vertex normals for a geometry containing <code>TRIANGLES</code> by averaging the normals of
* all triangles incident to the vertex. The result is a new <code>normal</code> attribute added to the geometry.
* This assumes a counter-clockwise winding order.
*
* @param {Geometry} geometry The geometry to modify.
*
* @returns {Geometry} The modified <code>geometry</code> argument with the computed <code>normal</code> attribute.
*
* @exception {DeveloperError} geometry is required.
* @exception {DeveloperError} geometry.attributes.position.values is required.
* @exception {DeveloperError} geometry.indices is required.
* @exception {DeveloperError} geometry.indices length must be greater than 0 and be a multiple of 3.
* @exception {DeveloperError} geometry.primitiveType must be {@link PrimitiveType.TRIANGLES}.
*
* @example
* GeometryPipeline.computeNormal(geometry);
*/
GeometryPipeline.computeNormal = function(geometry) {
if (!defined(geometry)) {
throw new DeveloperError('geometry is required.');
}
var attributes = geometry.attributes;
var indices = geometry.indices;
if (!defined(attributes.position) || !defined(attributes.position.values)) {
throw new DeveloperError('geometry.attributes.position.values is required.');
}
if (!defined(indices)) {
throw new DeveloperError('geometry.indices is required.');
}
if (indices.length < 2 || indices.length % 3 !== 0) {
throw new DeveloperError('geometry.indices length must be greater than 0 and be a multiple of 3.');
}
if (geometry.primitiveType.value !== PrimitiveType.TRIANGLES.value) {
throw new DeveloperError('geometry.primitiveType must be PrimitiveType.TRIANGLES.');
}
var vertices = geometry.attributes.position.values;
var numVertices = geometry.attributes.position.values.length / 3;
var numIndices = indices.length;
var normalsPerVertex = new Array(numVertices);
var normalsPerTriangle = new Array(numIndices / 3);
var normalIndices = new Array(numIndices);
for ( var i = 0; i < numVertices; i++) {
normalsPerVertex[i] = {
indexOffset : 0,
count : 0,
currentCount : 0
};
}
var j = 0;
for (i = 0; i < numIndices; i += 3) {
var i0 = indices[i];
var i1 = indices[i + 1];
var i2 = indices[i + 2];
var i03 = i0 * 3;
var i13 = i1 * 3;
var i23 = i2 * 3;
v0.x = vertices[i03];
v0.y = vertices[i03 + 1];
v0.z = vertices[i03 + 2];
v1.x = vertices[i13];
v1.y = vertices[i13 + 1];
v1.z = vertices[i13 + 2];
v2.x = vertices[i23];
v2.y = vertices[i23 + 1];
v2.z = vertices[i23 + 2];
normalsPerVertex[i0].count++;
normalsPerVertex[i1].count++;
normalsPerVertex[i2].count++;
Cartesian3.subtract(v1, v0, v1);
Cartesian3.subtract(v2, v0, v2);
normalsPerTriangle[j] = Cartesian3.cross(v1, v2);
j++;
}
var indexOffset = 0;
for (i = 0; i < numVertices; i++) {
normalsPerVertex[i].indexOffset += indexOffset;
indexOffset += normalsPerVertex[i].count;
}
j = 0;
var vertexNormalData;
for (i = 0; i < numIndices; i += 3) {
vertexNormalData = normalsPerVertex[indices[i]];
var index = vertexNormalData.indexOffset + vertexNormalData.currentCount;
normalIndices[index] = j;
vertexNormalData.currentCount++;
vertexNormalData = normalsPerVertex[indices[i + 1]];
index = vertexNormalData.indexOffset + vertexNormalData.currentCount;
normalIndices[index] = j;
vertexNormalData.currentCount++;
vertexNormalData = normalsPerVertex[indices[i + 2]];
index = vertexNormalData.indexOffset + vertexNormalData.currentCount;
normalIndices[index] = j;
vertexNormalData.currentCount++;
j++;
}
var normalValues = new Float32Array(numVertices * 3);
for (i = 0; i < numVertices; i++) {
var i3 = i * 3;
vertexNormalData = normalsPerVertex[i];
if (vertexNormalData.count > 0) {
Cartesian3.clone(Cartesian3.ZERO, normal);
for (j = 0; j < vertexNormalData.count; j++) {
Cartesian3.add(normal, normalsPerTriangle[normalIndices[vertexNormalData.indexOffset + j]], normal);
}
Cartesian3.normalize(normal, normal);
normalValues[i3] = normal.x;
normalValues[i3 + 1] = normal.y;
normalValues[i3 + 2] = normal.z;
} else {
normalValues[i3] = 0.0;
normalValues[i3 + 1] = 0.0;
normalValues[i3 + 2] = 1.0;
}
}
geometry.attributes.normal = new GeometryAttribute({
componentDatatype : ComponentDatatype.FLOAT,
componentsPerAttribute : 3,
values : normalValues
});
return geometry;
};
var normalScratch = new Cartesian3();
var normalScale = new Cartesian3();
var tScratch = new Cartesian3();
/**
* Computes per-vertex binormals and tangents for a geometry containing <code>TRIANGLES</code>.
* The result is new <code>binormal</code> and <code>tangent</code> attributes added to the geometry.
* This assumes a counter-clockwise winding order.
* <p>
* Based on <a href="http://www.terathon.com/code/tangent.html">Computing Tangent Space Basis Vectors
* for an Arbitrary Mesh</a> by Eric Lengyel.
* </p>
*
* @param {Geometry} geometry The geometry to modify.
*
* @returns {Geometry} The modified <code>geometry</code> argument with the computed <code>binormal</code> and <code>tangent</code> attributes.
*
* @exception {DeveloperError} geometry is required.
* @exception {DeveloperError} geometry.attributes.position.values is required.
* @exception {DeveloperError} geometry.attributes.normal.values is required.
* @exception {DeveloperError} geometry.attributes.st.values is required.
* @exception {DeveloperError} geometry.indices is required.
* @exception {DeveloperError} geometry.indices length must be greater than 0 and be a multiple of 3.
* @exception {DeveloperError} geometry.primitiveType must be {@link PrimitiveType.TRIANGLES}.
*
* @example
* GeometryPipeline.computeBinormalAndTangent(geometry);
*/
GeometryPipeline.computeBinormalAndTangent = function(geometry) {
if (!defined(geometry)) {
throw new DeveloperError('geometry is required.');
}
var attributes = geometry.attributes;
var indices = geometry.indices;
if (!defined(attributes.position) || !defined(attributes.position.values)) {
throw new DeveloperError('geometry.attributes.position.values is required.');
}
if (!defined(attributes.normal) || !defined(attributes.normal.values)) {
throw new DeveloperError('geometry.attributes.normal.values is required.');
}
if (!defined(attributes.st) || !defined(attributes.st.values)) {
throw new DeveloperError('geometry.attributes.st.values is required.');
}
if (!defined(indices)) {
throw new DeveloperError('geometry.indices is required.');
}
if (indices.length < 2 || indices.length % 3 !== 0) {
throw new DeveloperError('geometry.indices length must be greater than 0 and be a multiple of 3.');
}
if (geometry.primitiveType.value !== PrimitiveType.TRIANGLES.value) {
throw new DeveloperError('geometry.primitiveType must be PrimitiveType.TRIANGLES.');
}
var vertices = geometry.attributes.position.values;
var normals = geometry.attributes.normal.values;
var st = geometry.attributes.st.values;
var numVertices = geometry.attributes.position.values.length / 3;
var numIndices = indices.length;
var tan1 = new Array(numVertices * 3);
for ( var i = 0; i < tan1.length; i++) {
tan1[i] = 0;
}
var i03;
var i13;
var i23;
for (i = 0; i < numIndices; i += 3) {
var i0 = indices[i];
var i1 = indices[i + 1];
var i2 = indices[i + 2];
i03 = i0 * 3;
i13 = i1 * 3;
i23 = i2 * 3;
var i02 = i0 * 2;
var i12 = i1 * 2;
var i22 = i2 * 2;
var ux = vertices[i03];
var uy = vertices[i03 + 1];
var uz = vertices[i03 + 2];
var wx = st[i02];
var wy = st[i02 + 1];
var t1 = st[i12 + 1] - wy;
var t2 = st[i22 + 1] - wy;
var r = 1.0 / ((st[i12] - wx) * t2 - (st[i22] - wx) * t1);
var sdirx = (t2 * (vertices[i13] - ux) - t1 * (vertices[i23] - ux)) * r;
var sdiry = (t2 * (vertices[i13 + 1] - uy) - t1 * (vertices[i23 + 1] - uy)) * r;
var sdirz = (t2 * (vertices[i13 + 2] - uz) - t1 * (vertices[i23 + 2] - uz)) * r;
tan1[i03] += sdirx;
tan1[i03 + 1] += sdiry;
tan1[i03 + 2] += sdirz;
tan1[i13] += sdirx;
tan1[i13 + 1] += sdiry;
tan1[i13 + 2] += sdirz;
tan1[i23] += sdirx;
tan1[i23 + 1] += sdiry;
tan1[i23 + 2] += sdirz;
}
var binormalValues = new Float32Array(numVertices * 3);
var tangentValues = new Float32Array(numVertices * 3);
for (i = 0; i < numVertices; i++) {
i03 = i * 3;
i13 = i03 + 1;
i23 = i03 + 2;
var n = Cartesian3.fromArray(normals, i03, normalScratch);
var t = Cartesian3.fromArray(tan1, i03, tScratch);
var scalar = Cartesian3.dot(n, t);
Cartesian3.multiplyByScalar(n, scalar, normalScale);
Cartesian3.normalize(Cartesian3.subtract(t, normalScale, t), t);
tangentValues[i03] = t.x;
tangentValues[i13] = t.y;
tangentValues[i23] = t.z;
Cartesian3.normalize(Cartesian3.cross(n, t, t), t);
binormalValues[i03] = t.x;
binormalValues[i13] = t.y;
binormalValues[i23] = t.z;
}
geometry.attributes.tangent = new GeometryAttribute({
componentDatatype : ComponentDatatype.FLOAT,
componentsPerAttribute : 3,
values : tangentValues
});
geometry.attributes.binormal = new GeometryAttribute({
componentDatatype : ComponentDatatype.FLOAT,
componentsPerAttribute : 3,
values : binormalValues
});
return geometry;
};
function indexTriangles(geometry) {
if (defined(geometry.indices)) {
return geometry;
}
var numberOfVertices = Geometry.computeNumberOfVertices(geometry);
if (numberOfVertices < 3) {
throw new DeveloperError('The number of vertices must be at least three.');
}
if (numberOfVertices % 3 !== 0) {
throw new DeveloperError('The number of vertices must be a multiple of three.');
}
var indices = IndexDatatype.createTypedArray(numberOfVertices, numberOfVertices);
for (var i = 0; i < numberOfVertices; ++i) {
indices[i] = i;
}
geometry.indices = indices;
return geometry;
}
function indexTriangleFan(geometry) {
var numberOfVertices = Geometry.computeNumberOfVertices(geometry);
if (numberOfVertices < 3) {
throw new DeveloperError('The number of vertices must be at least three.');
}
var indices = IndexDatatype.createTypedArray(numberOfVertices, (numberOfVertices - 2) * 3);
indices[0] = 1;
indices[1] = 0;
indices[2] = 2;
var indicesIndex = 3;
for (var i = 3; i < numberOfVertices; ++i) {
indices[indicesIndex++] = i - 1;
indices[indicesIndex++] = 0;
indices[indicesIndex++] = i;
}
geometry.indices = indices;
geometry.primitiveType = PrimitiveType.TRIANGLES;
return geometry;
}
function indexTriangleStrip(geometry) {
var numberOfVertices = Geometry.computeNumberOfVertices(geometry);
if (numberOfVertices < 3) {
throw new DeveloperError('The number of vertices must be at least 3.');
}
var indices = IndexDatatype.createTypedArray(numberOfVertices, (numberOfVertices - 2) * 3);
indices[0] = 0;
indices[1] = 1;
indices[2] = 2;
if (numberOfVertices > 3) {
indices[3] = 0;
indices[4] = 2;
indices[5] = 3;
}
var indicesIndex = 6;
for (var i = 3; i < numberOfVertices - 1; i += 2) {
indices[indicesIndex++] = i;
indices[indicesIndex++] = i - 1;
indices[indicesIndex++] = i + 1;
if (i + 2 < numberOfVertices) {
indices[indicesIndex++] = i;
indices[indicesIndex++] = i + 1;
indices[indicesIndex++] = i + 2;
}
}
geometry.indices = indices;
geometry.primitiveType = PrimitiveType.TRIANGLES;
return geometry;
}
function indexLines(geometry) {
if (defined(geometry.indices)) {
return geometry;
}
var numberOfVertices = Geometry.computeNumberOfVertices(geometry);
if (numberOfVertices < 2) {
throw new DeveloperError('The number of vertices must be at least two.');
}
if (numberOfVertices % 2 !== 0) {
throw new DeveloperError('The number of vertices must be a multiple of 2.');
}
var indices = IndexDatatype.createTypedArray(numberOfVertices, numberOfVertices);
for (var i = 0; i < numberOfVertices; ++i) {
indices[i] = i;
}
geometry.indices = indices;
return geometry;
}
function indexLineStrip(geometry) {
var numberOfVertices = Geometry.computeNumberOfVertices(geometry);
if (numberOfVertices < 2) {
throw new DeveloperError('The number of vertices must be at least two.');
}
var indices = IndexDatatype.createTypedArray(numberOfVertices, (numberOfVertices - 1) * 2);
indices[0] = 0;
indices[1] = 1;
var indicesIndex = 2;
for (var i = 2; i < numberOfVertices; ++i) {
indices[indicesIndex++] = i - 1;
indices[indicesIndex++] = i;
}
geometry.indices = indices;
geometry.primitiveType = PrimitiveType.LINES;
return geometry;
}
function indexLineLoop(geometry) {
var numberOfVertices = Geometry.computeNumberOfVertices(geometry);
if (numberOfVertices < 2) {
throw new DeveloperError('The number of vertices must be at least two.');
}
var indices = IndexDatatype.createTypedArray(numberOfVertices, numberOfVertices * 2);
indices[0] = 0;
indices[1] = 1;
var indicesIndex = 2;
for (var i = 2; i < numberOfVertices; ++i) {
indices[indicesIndex++] = i - 1;
indices[indicesIndex++] = i;
}
indices[indicesIndex++] = numberOfVertices - 1;
indices[indicesIndex] = 0;
geometry.indices = indices;
geometry.primitiveType = PrimitiveType.LINES;
return geometry;
}
function indexPrimitive(geometry) {
switch (geometry.primitiveType.value) {
case PrimitiveType.TRIANGLE_FAN.value:
return indexTriangleFan(geometry);
case PrimitiveType.TRIANGLE_STRIP.value:
return indexTriangleStrip(geometry);
case PrimitiveType.TRIANGLES.value:
return indexTriangles(geometry);
case PrimitiveType.LINE_STRIP.value:
return indexLineStrip(geometry);
case PrimitiveType.LINE_LOOP.value:
return indexLineLoop(geometry);
case PrimitiveType.LINES.value:
return indexLines(geometry);
}
return geometry;
}
function offsetPointFromXZPlane(p, isBehind) {
if (Math.abs(p.y) < CesiumMath.EPSILON11){
if (isBehind) {
p.y = -CesiumMath.EPSILON11;
} else {
p.y = CesiumMath.EPSILON11;
}
}
}
var c3 = new Cartesian3();
function getXZIntersectionOffsetPoints(p, p1, u1, v1) {
Cartesian3.add(p, Cartesian3.multiplyByScalar(Cartesian3.subtract(p1, p, c3), p.y/(p.y-p1.y), c3), u1);
Cartesian3.clone(u1, v1);
offsetPointFromXZPlane(u1, true);
offsetPointFromXZPlane(v1, false);
}
var u1 = new Cartesian3();
var u2 = new Cartesian3();
var q1 = new Cartesian3();
var q2 = new Cartesian3();
var splitTriangleResult = {
positions : new Array(7),
indices : new Array(3 * 3)
};
function splitTriangle(p0, p1, p2) {
// In WGS84 coordinates, for a triangle approximately on the
// ellipsoid to cross the IDL, first it needs to be on the
// negative side of the plane x = 0.
if ((p0.x >= 0.0) || (p1.x >= 0.0) || (p2.x >= 0.0)) {
return undefined;
}
var p0Behind = p0.y < 0.0;
var p1Behind = p1.y < 0.0;
var p2Behind = p2.y < 0.0;
offsetPointFromXZPlane(p0, p0Behind);
offsetPointFromXZPlane(p1, p1Behind);
offsetPointFromXZPlane(p2, p2Behind);
var numBehind = 0;
numBehind += p0Behind ? 1 : 0;
numBehind += p1Behind ? 1 : 0;
numBehind += p2Behind ? 1 : 0;
var indices = splitTriangleResult.indices;
if (numBehind === 1) {
indices[1] = 3;
indices[2] = 4;
indices[5] = 6;
indices[7] = 6;
indices[8] = 5;
if (p0Behind) {
getXZIntersectionOffsetPoints(p0, p1, u1, q1);
getXZIntersectionOffsetPoints(p0, p2, u2, q2);
indices[0] = 0;
indices[3] = 1;
indices[4] = 2;
indices[6] = 1;
} else if (p1Behind) {
getXZIntersectionOffsetPoints(p1, p2, u1, q1);
getXZIntersectionOffsetPoints(p1, p0, u2, q2);
indices[0] = 1;
indices[3] = 2;
indices[4] = 0;
indices[6] = 2;
} else if (p2Behind) {
getXZIntersectionOffsetPoints(p2, p0, u1, q1);
getXZIntersectionOffsetPoints(p2, p1, u2, q2);
indices[0] = 2;
indices[3] = 0;
indices[4] = 1;
indices[6] = 0;
}
} else if (numBehind === 2) {
indices[2] = 4;
indices[4] = 4;
indices[5] = 3;
indices[7] = 5;
indices[8] = 6;
if (!p0Behind) {
getXZIntersectionOffsetPoints(p0, p1, u1, q1);
getXZIntersectionOffsetPoints(p0, p2, u2, q2);
indices[0] = 1;
indices[1] = 2;
indices[3] = 1;
indices[6] = 0;
} else if (!p1Behind) {
getXZIntersectionOffsetPoints(p1, p2, u1, q1);
getXZIntersectionOffsetPoints(p1, p0, u2, q2);
indices[0] = 2;
indices[1] = 0;
indices[3] = 2;
indices[6] = 1;
} else if (!p2Behind) {
getXZIntersectionOffsetPoints(p2, p0, u1, q1);
getXZIntersectionOffsetPoints(p2, p1, u2, q2);
indices[0] = 0;
indices[1] = 1;
indices[3] = 0;
indices[6] = 2;
}
}
var positions = splitTriangleResult.positions;
positions[0] = p0;
positions[1] = p1;
positions[2] = p2;
splitTriangleResult.length = 3;
if (numBehind === 1 || numBehind === 2) {
positions[3] = u1;
positions[4] = u2;
positions[5] = q1;
positions[6] = q2;
splitTriangleResult.length = 7;
}
return splitTriangleResult;
}
function computeTriangleAttributes(i0, i1, i2, dividedTriangle, normals, binormals, tangents, texCoords) {
if (!defined(normals) && !defined(binormals) && !defined(tangents) && !defined(texCoords)) {
return;
}
var positions = dividedTriangle.positions;
var p0 = positions[0];
var p1 = positions[1];
var p2 = positions[2];
var n0, n1, n2;
var b0, b1, b2;
var t0, t1, t2;
var s0, s1, s2;
var v0, v1, v2;
var u0, u1, u2;
if (defined(normals)) {
n0 = Cartesian3.fromArray(normals, i0 * 3);
n1 = Cartesian3.fromArray(normals, i1 * 3);
n2 = Cartesian3.fromArray(normals, i2 * 3);
}
if (defined(binormals)) {
b0 = Cartesian3.fromArray(binormals, i0 * 3);
b1 = Cartesian3.fromArray(binormals, i1 * 3);
b2 = Cartesian3.fromArray(binormals, i2 * 3);
}
if (defined(tangents)) {
t0 = Cartesian3.fromArray(tangents, i0 * 3);
t1 = Cartesian3.fromArray(tangents, i1 * 3);
t2 = Cartesian3.fromArray(tangents, i2 * 3);
}
if (defined(texCoords)) {
s0 = Cartesian2.fromArray(texCoords, i0 * 2);
s1 = Cartesian2.fromArray(texCoords, i1 * 2);
s2 = Cartesian2.fromArray(texCoords, i2 * 2);
}
for (var i = 3; i < positions.length; ++i) {
var point = positions[i];
var coords = barycentricCoordinates(point, p0, p1, p2);
if (defined(normals)) {
v0 = Cartesian3.multiplyByScalar(n0, coords.x, v0);
v1 = Cartesian3.multiplyByScalar(n1, coords.y, v1);
v2 = Cartesian3.multiplyByScalar(n2, coords.z, v2);
var normal = Cartesian3.add(v0, v1);
Cartesian3.add(normal, v2, normal);
Cartesian3.normalize(normal, normal);
normals.push(normal.x, normal.y, normal.z);
}
if (defined(binormals)) {
v0 = Cartesian3.multiplyByScalar(b0, coords.x, v0);
v1 = Cartesian3.multiplyByScalar(b1, coords.y, v1);
v2 = Cartesian3.multiplyByScalar(b2, coords.z, v2);
var binormal = Cartesian3.add(v0, v1);
Cartesian3.add(binormal, v2, binormal);
Cartesian3.normalize(binormal, binormal);
binormals.push(binormal.x, binormal.y, binormal.z);
}
if (defined(tangents)) {
v0 = Cartesian3.multiplyByScalar(t0, coords.x, v0);
v1 = Cartesian3.multiplyByScalar(t1, coords.y, v1);
v2 = Cartesian3.multiplyByScalar(t2, coords.z, v2);
var tangent = Cartesian3.add(v0, v1);
Cartesian3.add(tangent, v2, tangent);
Cartesian3.normalize(tangent, tangent);
tangents.push(tangent.x, tangent.y, tangent.z);
}
if (defined(texCoords)) {
u0 = Cartesian2.multiplyByScalar(s0, coords.x, u0);
u1 = Cartesian2.multiplyByScalar(s1, coords.y, u1);
u2 = Cartesian2.multiplyByScalar(s2, coords.z, u2);
var texCoord = Cartesian2.add(u0, u1);
Cartesian2.add(texCoord, u2, texCoord);
texCoords.push(texCoord.x, texCoord.y);
}
}
}
function wrapLongitudeTriangles(geometry) {
var attributes = geometry.attributes;
var positions = attributes.position.values;
var normals = (defined(attributes.normal)) ? attributes.normal.values : undefined;
var binormals = (defined(attributes.binormal)) ? attributes.binormal.values : undefined;
var tangents = (defined(attributes.tangent)) ? attributes.tangent.values : undefined;
var texCoords = (defined(attributes.st)) ? attributes.st.values : undefined;
var indices = geometry.indices;
var newPositions = Array.prototype.slice.call(positions, 0);
var newNormals = (defined(normals)) ? Array.prototype.slice.call(normals, 0) : undefined;
var newBinormals = (defined(binormals)) ? Array.prototype.slice.call(binormals, 0) : undefined;
var newTangents = (defined(tangents)) ? Array.prototype.slice.call(tangents, 0) : undefined;
var newTexCoords = (defined(texCoords)) ? Array.prototype.slice.call(texCoords, 0) : undefined;
var newIndices = [];
var len = indices.length;
for (var i = 0; i < len; i += 3) {
var i0 = indices[i];
var i1 = indices[i + 1];
var i2 = indices[i + 2];
var p0 = Cartesian3.fromArray(positions, i0 * 3);
var p1 = Cartesian3.fromArray(positions, i1 * 3);
var p2 = Cartesian3.fromArray(positions, i2 * 3);
var result = splitTriangle(p0, p1, p2);
if (defined(result)) {
newPositions[i0 * 3 + 1] = result.positions[0].y;
newPositions[i1 * 3 + 1] = result.positions[1].y;
newPositions[i2 * 3 + 1] = result.positions[2].y;
if (result.length > 3) {
var positionsLength = newPositions.length / 3;
for(var j = 0; j < result.indices.length; ++j) {
var index = result.indices[j];
if (index < 3) {
newIndices.push(indices[i + index]);
} else {
newIndices.push(index - 3 + positionsLength);
}
}
for (var k = 3; k < result.positions.length; ++k) {
var position = result.positions[k];
newPositions.push(position.x, position.y, position.z);
}
computeTriangleAttributes(i0, i1, i2, result, newNormals, newBinormals, newTangents, newTexCoords);
} else {
newIndices.push(i0, i1, i2);
}
} else {
newIndices.push(i0, i1, i2);
}
}
geometry.attributes.position.values = new Float64Array(newPositions);
if (defined(newNormals)) {
attributes.normal.values = ComponentDatatype.createTypedArray(attributes.normal.componentDatatype, newNormals);
}
if (defined(newBinormals)) {
attributes.binormal.values = ComponentDatatype.createTypedArray(attributes.binormal.componentDatatype, newBinormals);
}
if (defined(newTangents)) {
attributes.tangent.values = ComponentDatatype.createTypedArray(attributes.tangent.componentDatatype, newTangents);
}
if (defined(newTexCoords)) {
attributes.st.values = ComponentDatatype.createTypedArray(attributes.st.componentDatatype, newTexCoords);
}
var numberOfVertices = Geometry.computeNumberOfVertices(geometry);
geometry.indices = IndexDatatype.createTypedArray(numberOfVertices, newIndices);
}
function wrapLongitudeLines(geometry) {
var attributes = geometry.attributes;
var positions = attributes.position.values;
var indices = geometry.indices;
var newPositions = Array.prototype.slice.call(positions, 0);
var newIndices = [];
var xzPlane = Plane.fromPointNormal(Cartesian3.ZERO, Cartesian3.UNIT_Y);
var length = indices.length;
for ( var i = 0; i < length; i += 2) {
var i0 = indices[i];
var i1 = indices[i + 1];
var prev = Cartesian3.fromArray(positions, i0 * 3);
var cur = Cartesian3.fromArray(positions, i1 * 3);
if (Math.abs(prev.y) < CesiumMath.EPSILON6){
if (prev.y < 0.0) {
prev.y = -CesiumMath.EPSILON6;
} else {
prev.y = CesiumMath.EPSILON6;
}
newPositions[i0 * 3 + 1] = prev.y;
}
if (Math.abs(cur.y) < CesiumMath.EPSILON6){
if (cur.y < 0.0) {
cur.y = -CesiumMath.EPSILON6;
} else {
cur.y = CesiumMath.EPSILON6;
}
newPositions[i1 * 3 + 1] = cur.y;
}
newIndices.push(i0);
// intersects the IDL if either endpoint is on the negative side of the yz-plane
if (prev.x < 0.0 || cur.x < 0.0) {
// and intersects the xz-plane
var intersection = IntersectionTests.lineSegmentPlane(prev, cur, xzPlane);
if (defined(intersection)) {
// move point on the xz-plane slightly away from the plane
var offset = Cartesian3.multiplyByScalar(Cartesian3.UNIT_Y, 5.0 * CesiumMath.EPSILON9);
if (prev.y < 0.0) {
Cartesian3.negate(offset, offset);
}
var index = newPositions.length / 3;
newIndices.push(index, index + 1);
var offsetPoint = Cartesian3.add(intersection, offset);
newPositions.push(offsetPoint.x, offsetPoint.y, offsetPoint.z);
Cartesian3.negate(offset, offset);
Cartesian3.add(intersection, offset, offsetPoint);
newPositions.push(offsetPoint.x, offsetPoint.y, offsetPoint.z);
}
}
newIndices.push(i1);
}
geometry.attributes.position.values = new Float64Array(newPositions);
var numberOfVertices = Geometry.computeNumberOfVertices(geometry);
geometry.indices = IndexDatatype.createTypedArray(numberOfVertices, newIndices);
}
/**
* Splits the geometry's primitives, by introducing new vertices and indices,that
* intersect the International Date Line so that no primitives cross longitude
* -180/180 degrees. This is not required for 3D drawing, but is required for
* correcting drawing in 2D and Columbus view.
*
* @param {Geometry} geometry The geometry to modify.
*
* @returns {Geometry} The modified <code>geometry</code> argument, with it's primitives split at the International Date Line.
*
* @exception {DeveloperError} geometry is required.
*
* @example
* geometry = GeometryPipeline.wrapLongitude(geometry);
*/
GeometryPipeline.wrapLongitude = function(geometry) {
if (!defined(geometry)) {
throw new DeveloperError('geometry is required.');
}
var boundingSphere = geometry.boundingSphere;
if (defined(boundingSphere)) {
var minX = boundingSphere.center.x - boundingSphere.radius;
if (minX > 0 || BoundingSphere.intersect(boundingSphere, Cartesian4.UNIT_Y) !== Intersect.INTERSECTING) {
return geometry;
}
}
indexPrimitive(geometry);
if (geometry.primitiveType.value === PrimitiveType.TRIANGLES.value) {
wrapLongitudeTriangles(geometry);
} else if (geometry.primitiveType.value === PrimitiveType.LINES.value) {
wrapLongitudeLines(geometry);
}
return geometry;
};
return GeometryPipeline;
});
/*global define*/
define('Scene/PrimitivePipeline',[
'../Core/defined',
'../Core/defaultValue',
'../Core/Color',
'../Core/ComponentDatatype',
'../Core/DeveloperError',
'../Core/FeatureDetection',
'../Core/Geometry',
'../Core/GeometryAttribute',
'../Core/GeometryPipeline',
'../Core/Matrix4'
], function(
defined,
defaultValue,
Color,
ComponentDatatype,
DeveloperError,
FeatureDetection,
Geometry,
GeometryAttribute,
GeometryPipeline,
Matrix4) {
"use strict";
// Bail out if the browser doesn't support typed arrays, to prevent the setup function
// from failing, since we won't be able to create a WebGL context anyway.
if (!FeatureDetection.supportsTypedArrays()) {
return {};
}
function transformToWorldCoordinates(instances, primitiveModelMatrix, allow3DOnly) {
var toWorld = !allow3DOnly;
var length = instances.length;
var i;
if (!toWorld && (length > 1)) {
var modelMatrix = instances[0].modelMatrix;
for (i = 1; i < length; ++i) {
if (!Matrix4.equals(modelMatrix, instances[i].modelMatrix)) {
toWorld = true;
break;
}
}
}
if (toWorld) {
for (i = 0; i < length; ++i) {
GeometryPipeline.transformToWorldCoordinates(instances[i]);
}
} else {
// Leave geometry in local coordinate system; auto update model-matrix.
Matrix4.clone(instances[0].modelMatrix, primitiveModelMatrix);
}
}
function addPickColorAttribute(instances, pickIds) {
var length = instances.length;
for (var i = 0; i < length; ++i) {
var instance = instances[i];
var geometry = instance.geometry;
var attributes = geometry.attributes;
var positionAttr = attributes.position;
var numberOfComponents = 4 * (positionAttr.values.length / positionAttr.componentsPerAttribute);
attributes.pickColor = new GeometryAttribute({
componentDatatype : ComponentDatatype.UNSIGNED_BYTE,
componentsPerAttribute : 4,
normalize : true,
values : new Uint8Array(numberOfComponents)
});
var pickColor = pickIds[i];
var red = Color.floatToByte(pickColor.red);
var green = Color.floatToByte(pickColor.green);
var blue = Color.floatToByte(pickColor.blue);
var alpha = Color.floatToByte(pickColor.alpha);
var values = attributes.pickColor.values;
for (var j = 0; j < numberOfComponents; j += 4) {
values[j] = red;
values[j + 1] = green;
values[j + 2] = blue;
values[j + 3] = alpha;
}
}
}
function getCommonPerInstanceAttributeNames(instances) {
var length = instances.length;
var attributesInAllInstances = [];
var attributes0 = instances[0].attributes;
var name;
for (name in attributes0) {
if (attributes0.hasOwnProperty(name)) {
var attribute = attributes0[name];
var inAllInstances = true;
// Does this same attribute exist in all instances?
for (var i = 1; i < length; ++i) {
var otherAttribute = instances[i].attributes[name];
if (!defined(otherAttribute) ||
(attribute.componentDatatype.value !== otherAttribute.componentDatatype.value) ||
(attribute.componentsPerAttribute !== otherAttribute.componentsPerAttribute) ||
(attribute.normalize !== otherAttribute.normalize)) {
inAllInstances = false;
break;
}
}
if (inAllInstances) {
attributesInAllInstances.push(name);
}
}
}
return attributesInAllInstances;
}
function addPerInstanceAttributes(instances, names) {
var length = instances.length;
for (var i = 0; i < length; ++i) {
var instance = instances[i];
var instanceAttributes = instance.attributes;
var geometry = instance.geometry;
var numberOfVertices = Geometry.computeNumberOfVertices(geometry);
var namesLength = names.length;
for (var j = 0; j < namesLength; ++j) {
var name = names[j];
var attribute = instanceAttributes[name];
var componentDatatype = attribute.componentDatatype;
var value = attribute.value;
var componentsPerAttribute = value.length;
var buffer = ComponentDatatype.createTypedArray(componentDatatype, numberOfVertices * componentsPerAttribute);
for (var k = 0; k < numberOfVertices; ++k) {
buffer.set(value, k * componentsPerAttribute);
}
geometry.attributes[name] = new GeometryAttribute({
componentDatatype : componentDatatype,
componentsPerAttribute : componentsPerAttribute,
normalize : attribute.normalize,
values : buffer
});
}
}
}
function geometryPipeline(parameters) {
var instances = parameters.instances;
var pickIds = parameters.pickIds;
var projection = parameters.projection;
var uintIndexSupport = parameters.elementIndexUintSupported;
var allow3DOnly = parameters.allow3DOnly;
var vertexCacheOptimize = parameters.vertexCacheOptimize;
var modelMatrix = parameters.modelMatrix;
var i;
var length = instances.length;
var primitiveType = instances[0].geometry.primitiveType;
for (i = 1; i < length; ++i) {
if (instances[i].geometry.primitiveType.value !== primitiveType.value) {
throw new DeveloperError('All instance geometries must have the same primitiveType.');
}
}
// Unify to world coordinates before combining.
transformToWorldCoordinates(instances, modelMatrix, allow3DOnly);
// Clip to IDL
if (!allow3DOnly) {
for (i = 0; i < length; ++i) {
GeometryPipeline.wrapLongitude(instances[i].geometry);
}
}
// Add pickColor attribute for picking individual instances
addPickColorAttribute(instances, pickIds);
// add attributes to the geometry for each per-instance attribute
var perInstanceAttributeNames = getCommonPerInstanceAttributeNames(instances);
addPerInstanceAttributes(instances, perInstanceAttributeNames);
// Optimize for vertex shader caches
if (vertexCacheOptimize) {
for (i = 0; i < length; ++i) {
GeometryPipeline.reorderForPostVertexCache(instances[i].geometry);
GeometryPipeline.reorderForPreVertexCache(instances[i].geometry);
}
}
// Combine into single geometry for better rendering performance.
var geometry = GeometryPipeline.combine(instances);
// Split positions for GPU RTE
var attributes = geometry.attributes;
var name;
if (!allow3DOnly) {
for (name in attributes) {
if (attributes.hasOwnProperty(name) && attributes[name].componentDatatype.value === ComponentDatatype.DOUBLE.value) {
var name3D = name + '3D';
var name2D = name + '2D';
// Compute 2D positions
GeometryPipeline.projectTo2D(geometry, name, name3D, name2D, projection);
GeometryPipeline.encodeAttribute(geometry, name3D, name3D + 'High', name3D + 'Low');
GeometryPipeline.encodeAttribute(geometry, name2D, name2D + 'High', name2D + 'Low');
}
}
} else {
for (name in attributes) {
if (attributes.hasOwnProperty(name) && attributes[name].componentDatatype.value === ComponentDatatype.DOUBLE.value) {
GeometryPipeline.encodeAttribute(geometry, name, name + '3DHigh', name + '3DLow');
}
}
}
if (!uintIndexSupport) {
// Break into multiple geometries to fit within unsigned short indices if needed
return GeometryPipeline.fitToUnsignedShortIndices(geometry);
}
// Unsigned int indices are supported. No need to break into multiple geometries.
return [geometry];
}
function createPerInstanceVAAttributes(geometry, attributeIndices, names) {
var vaAttributes = [];
var attributes = geometry.attributes;
var length = names.length;
for (var i = 0; i < length; ++i) {
var name = names[i];
var attribute = attributes[name];
var componentDatatype = attribute.componentDatatype;
if (componentDatatype.value === ComponentDatatype.DOUBLE.value) {
componentDatatype = ComponentDatatype.FLOAT;
}
var typedArray = ComponentDatatype.createTypedArray(componentDatatype, attribute.values);
vaAttributes.push({
index : attributeIndices[name],
componentDatatype : componentDatatype,
componentsPerAttribute : attribute.componentsPerAttribute,
normalize : attribute.normalize,
values : typedArray
});
delete attributes[name];
}
return vaAttributes;
}
function computePerInstanceAttributeIndices(instances, vertexArrays, attributeIndices) {
var indices = [];
var names = getCommonPerInstanceAttributeNames(instances);
var length = instances.length;
var offsets = {};
var vaIndices = {};
for (var i = 0; i < length; ++i) {
var instance = instances[i];
var numberOfVertices = Geometry.computeNumberOfVertices(instance.geometry);
var namesLength = names.length;
for (var j = 0; j < namesLength; ++j) {
var name = names[j];
var index = attributeIndices[name];
var tempVertexCount = numberOfVertices;
while (tempVertexCount > 0) {
var vaIndex = defaultValue(vaIndices[name], 0);
var va = vertexArrays[vaIndex];
var vaLength = va.length;
var attribute;
for (var k = 0; k < vaLength; ++k) {
attribute = va[k];
if (attribute.index === index) {
break;
}
}
if (!defined(indices[i])) {
indices[i] = {};
}
if (!defined(indices[i][name])) {
indices[i][name] = {
dirty : false,
value : instance.attributes[name].value,
indices : []
};
}
var size = attribute.values.length / attribute.componentsPerAttribute;
var offset = defaultValue(offsets[name], 0);
var count;
if (offset + tempVertexCount < size) {
count = tempVertexCount;
indices[i][name].indices.push({
attribute : attribute,
offset : offset,
count : count
});
offsets[name] = offset + tempVertexCount;
} else {
count = size - offset;
indices[i][name].indices.push({
attribute : attribute,
offset : offset,
count : count
});
offsets[name] = 0;
vaIndices[name] = vaIndex + 1;
}
tempVertexCount -= count;
}
}
}
return indices;
}
/**
* @private
*/
var PrimitivePipeline = {};
/**
* @private
*/
PrimitivePipeline.combineGeometry = function(parameters) {
var clonedParameters = {
instances : parameters.instances,
pickIds : parameters.pickIds,
ellipsoid : parameters.ellipsoid,
projection : parameters.projection,
elementIndexUintSupported : parameters.elementIndexUintSupported,
allow3DOnly : parameters.allow3DOnly,
vertexCacheOptimize : parameters.vertexCacheOptimize,
modelMatrix : Matrix4.clone(parameters.modelMatrix)
};
var geometries = geometryPipeline(clonedParameters);
var attributeIndices = GeometryPipeline.createAttributeIndices(geometries[0]);
var instances = clonedParameters.instances;
var perInstanceAttributeNames = getCommonPerInstanceAttributeNames(instances);
var perInstanceAttributes = [];
var length = geometries.length;
for (var i = 0; i < length; ++i) {
var geometry = geometries[i];
perInstanceAttributes.push(createPerInstanceVAAttributes(geometry, attributeIndices, perInstanceAttributeNames));
}
var indices = computePerInstanceAttributeIndices(instances, perInstanceAttributes, attributeIndices);
return {
geometries : geometries,
modelMatrix : clonedParameters.modelMatrix,
attributeIndices : attributeIndices,
vaAttributes : perInstanceAttributes,
vaAttributeIndices : indices
};
};
/*
* The below functions are needed when transferring typed arrays to/from web
* workers. This is a workaround for:
*
* https://bugzilla.mozilla.org/show_bug.cgi?id=841904
*/
function stupefyTypedArray(typedArray) {
return {
type : typedArray.constructor.name,
buffer : typedArray.buffer
};
}
var typedArrayMap = {
Int8Array : Int8Array,
Uint8Array : Uint8Array,
Int16Array : Int16Array,
Uint16Array : Uint16Array,
Int32Array : Int32Array,
Uint32Array : Uint32Array,
Float32Array : Float32Array,
Float64Array : Float64Array
};
function unStupefyTypedArray(typedArray) {
return new typedArrayMap[typedArray.type](typedArray.buffer);
}
/**
* @private
*/
PrimitivePipeline.transferGeometry = function(geometry, transferableObjects) {
var typedArray;
var attributes = geometry.attributes;
for (var name in attributes) {
if (attributes.hasOwnProperty(name) &&
defined(attributes[name]) &&
defined(attributes[name].values)) {
typedArray = attributes[name].values;
if (transferableObjects.indexOf(attributes[name].values.buffer) < 0) {
transferableObjects.push(typedArray.buffer);
}
if (!defined(typedArray.type)) {
attributes[name].values = stupefyTypedArray(typedArray);
}
}
}
if (defined(geometry.indices)) {
typedArray = geometry.indices;
transferableObjects.push(typedArray.buffer);
if (!defined(typedArray.type)) {
geometry.indices = stupefyTypedArray(geometry.indices);
}
}
};
/**
* @private
*/
PrimitivePipeline.transferGeometries = function(geometries, transferableObjects) {
var length = geometries.length;
for (var i = 0; i < length; ++i) {
PrimitivePipeline.transferGeometry(geometries[i], transferableObjects);
}
};
/**
* @private
*/
PrimitivePipeline.transferPerInstanceAttributes = function(perInstanceAttributes, transferableObjects) {
var length = perInstanceAttributes.length;
for (var i = 0; i < length; ++i) {
var vaAttributes = perInstanceAttributes[i];
var vaLength = vaAttributes.length;
for (var j = 0; j < vaLength; ++j) {
var typedArray = vaAttributes[j].values;
transferableObjects.push(typedArray.buffer);
vaAttributes[j].values = stupefyTypedArray(typedArray);
}
}
};
/**
* @private
*/
PrimitivePipeline.transferInstances = function(instances, transferableObjects) {
var length = instances.length;
for (var i = 0; i < length; ++i) {
var instance = instances[i];
PrimitivePipeline.transferGeometry(instance.geometry, transferableObjects);
}
};
/**
* @private
*/
PrimitivePipeline.receiveGeometry = function(geometry) {
var attributes = geometry.attributes;
for (var name in attributes) {
if (attributes.hasOwnProperty(name) &&
defined(attributes[name]) &&
defined(attributes[name].values)) {
attributes[name].values = unStupefyTypedArray(attributes[name].values);
}
}
if (defined(geometry.indices)) {
geometry.indices = unStupefyTypedArray(geometry.indices);
}
};
/**
* @private
*/
PrimitivePipeline.receiveGeometries = function(geometries) {
var length = geometries.length;
for (var i = 0; i < length; ++i) {
PrimitivePipeline.receiveGeometry(geometries[i]);
}
};
/**
* @private
*/
PrimitivePipeline.receivePerInstanceAttributes = function(perInstanceAttributes) {
var length = perInstanceAttributes.length;
for (var i = 0; i < length; ++i) {
var vaAttributes = perInstanceAttributes[i];
var vaLength = vaAttributes.length;
for (var j = 0; j < vaLength; ++j) {
vaAttributes[j].values = unStupefyTypedArray(vaAttributes[j].values);
}
}
};
/**
* @private
*/
PrimitivePipeline.receiveInstances = function(instances) {
var length = instances.length;
for (var i = 0; i < length; ++i) {
var instance = instances[i];
PrimitivePipeline.receiveGeometry(instance.geometry);
}
};
return PrimitivePipeline;
});
/*global define*/
define('Workers/createTaskProcessorWorker',[
'../Core/defaultValue',
'../Core/defined'
], function(
defaultValue,
defined) {
"use strict";
/**
* Creates an adapter function to allow a calculation function to operate as a Web Worker,
* paired with TaskProcessor, to receive tasks and return results.
*
* @exports createTaskProcessorWorker
*
* @param {Function} workerFunction A function that takes as input two arguments:
* a parameters object, and an array into which transferable result objects can be pushed,
* and returns as output a result object.
* @returns {Function} An adapter function that handles the interaction with TaskProcessor,
* specifically, task ID management and posting a response message containing the result.
*
* @example
* function doCalculation(parameters, transferableObjects) {
* // calculate some result using the inputs in parameters
* return result;
* }
*
* return createTaskProcessorWorker(doCalculation);
* // the resulting function is compatible with TaskProcessor
*
* @see TaskProcessor
* @see <a href='http://www.w3.org/TR/workers/'>Web Workers</a>
* @see <a href='http://www.w3.org/TR/html5/common-dom-interfaces.html#transferable-objects'>Transferable objects</a>
*/
var createTaskProcessorWorker = function(workerFunction) {
var postMessage;
var transferableObjects = [];
var responseMessage = {
id : undefined,
result : undefined,
error : undefined
};
return function(event) {
/*global self*/
var data = event.data;
transferableObjects.length = 0;
responseMessage.id = data.id;
responseMessage.error = undefined;
responseMessage.result = undefined;
try {
responseMessage.result = workerFunction(data.parameters, transferableObjects);
} catch (e) {
responseMessage.error = e;
}
if (!defined(postMessage)) {
postMessage = defaultValue(self.webkitPostMessage, self.postMessage);
}
try {
postMessage(responseMessage, transferableObjects);
} catch (e) {
// something went wrong trying to post the message, post a simpler
// error that we can be sure will be cloneable
responseMessage.result = undefined;
responseMessage.error = 'postMessage failed with error: ' + e + '\n with responseMessage: ' + JSON.stringify(responseMessage);
postMessage(responseMessage);
}
};
};
return createTaskProcessorWorker;
});
/*global define*/
define('Workers/createBoxGeometry',[
'../Core/BoxGeometry',
'../Scene/PrimitivePipeline',
'./createTaskProcessorWorker'
], function(
BoxGeometry,
PrimitivePipeline,
createTaskProcessorWorker) {
"use strict";
function createBoxGeometry(parameters, transferableObjects) {
var boxGeometry = parameters.geometry;
var geometry = BoxGeometry.createGeometry(boxGeometry);
PrimitivePipeline.transferGeometry(geometry, transferableObjects);
return {
geometry : geometry,
index : parameters.index
};
}
return createTaskProcessorWorker(createBoxGeometry);
});
}());
|
describe('landscape', function () {
beforeEach(angular.mock.module(require('./').name));
var scope, compile;
beforeEach(inject(function ($rootScope, $compile) {
scope = $rootScope.$new();
compile = $compile;
}));
it('should ...', function () {
/*
To test your directive, you need to create some html that would use your directive,
send that through compile() then compare the results.
var element = compile('<div landscape name="name">hi</div>')(scope);
expect(element.text()).toBe('hello, world');
*/
});
});
|
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TreeService = void 0;
var tree_events_1 = require("./tree.events");
var core_1 = require("@angular/core");
var node_draggable_service_1 = require("./draggable/node-draggable.service");
var fn_utils_1 = require("./utils/fn.utils");
var rxjs_1 = require("rxjs");
var operators_1 = require("rxjs/operators");
var i0 = require("@angular/core");
var i1 = require("./draggable/node-draggable.service");
var TreeService = /** @class */ (function () {
function TreeService(nodeDraggableService) {
var _this = this;
this.nodeDraggableService = nodeDraggableService;
this.nodeMoved$ = new rxjs_1.Subject();
this.nodeMoveStarted$ = new rxjs_1.Subject();
this.nodeRemoved$ = new rxjs_1.Subject();
this.nodeRenamed$ = new rxjs_1.Subject();
this.nodeCreated$ = new rxjs_1.Subject();
this.nodeDoubleClicked$ = new rxjs_1.Subject();
this.nodeSelected$ = new rxjs_1.Subject();
this.nodeUnselected$ = new rxjs_1.Subject();
this.nodeExpanded$ = new rxjs_1.Subject();
this.nodeCollapsed$ = new rxjs_1.Subject();
this.menuItemSelected$ = new rxjs_1.Subject();
this.loadNextLevel$ = new rxjs_1.Subject();
this.nodeChecked$ = new rxjs_1.Subject();
this.nodeUnchecked$ = new rxjs_1.Subject();
this.nodeIndeterminate$ = new rxjs_1.Subject();
this.nodeRenameKeydown$ = new rxjs_1.Subject();
this.nodeRenameInputChange$ = new rxjs_1.Subject();
this.controllers = new Map();
this.nodeRemoved$.subscribe(function (e) { return e.node.removeItselfFromParent(); });
this.nodeDraggableService.nodeDragStartEvents$.subscribe(function (e) {
_this.nodeMoveStarted$.next(e);
});
}
TreeService.prototype.unselectStream = function (tree) {
return this.nodeSelected$.pipe(operators_1.filter(function (e) { return tree !== e.node; }));
};
TreeService.prototype.fireNodeRenameKeydownEvent = function (tree, e) {
this.nodeRenameKeydown$.next(new tree_events_1.NodeRenameKeydownEvent(tree, e));
};
TreeService.prototype.fireNodeRenameInputChanged = function (tree, e) {
this.nodeRenameInputChange$.next(new tree_events_1.NodeRenameInputChangeEvent(tree, e));
};
TreeService.prototype.fireNodeRemoved = function (tree) {
this.nodeRemoved$.next(new tree_events_1.NodeRemovedEvent(tree, tree.positionInParent));
};
TreeService.prototype.fireNodeCreated = function (tree) {
this.nodeCreated$.next(new tree_events_1.NodeCreatedEvent(tree));
};
TreeService.prototype.fireNodeDoubleClicked = function (tree, e) {
this.nodeDoubleClicked$.next(new tree_events_1.NodeDoubleClickedEvent(tree, e));
};
TreeService.prototype.fireNodeSelected = function (tree) {
this.nodeSelected$.next(new tree_events_1.NodeSelectedEvent(tree));
};
TreeService.prototype.fireNodeUnselected = function (tree) {
this.nodeUnselected$.next(new tree_events_1.NodeUnselectedEvent(tree));
};
TreeService.prototype.fireNodeRenamed = function (oldValue, tree) {
this.nodeRenamed$.next(new tree_events_1.NodeRenamedEvent(tree, oldValue, tree.value));
};
TreeService.prototype.fireNodeMoved = function (tree, parent, previousPosition) {
this.nodeMoved$.next(new tree_events_1.NodeMovedEvent(tree, parent, previousPosition));
};
TreeService.prototype.fireMenuItemSelected = function (tree, selectedItem) {
this.menuItemSelected$.next(new tree_events_1.MenuItemSelectedEvent(tree, selectedItem));
};
TreeService.prototype.fireNodeSwitchFoldingType = function (tree) {
if (tree.isNodeExpanded()) {
this.fireNodeExpanded(tree);
if (this.shouldFireLoadNextLevel(tree)) {
this.fireLoadNextLevel(tree);
}
}
else if (tree.isNodeCollapsed()) {
this.fireNodeCollapsed(tree);
}
};
TreeService.prototype.fireNodeExpanded = function (tree) {
this.nodeExpanded$.next(new tree_events_1.NodeExpandedEvent(tree));
};
TreeService.prototype.fireNodeCollapsed = function (tree) {
this.nodeCollapsed$.next(new tree_events_1.NodeCollapsedEvent(tree));
};
TreeService.prototype.fireLoadNextLevel = function (tree) {
this.loadNextLevel$.next(new tree_events_1.LoadNextLevelEvent(tree));
};
TreeService.prototype.fireNodeChecked = function (tree) {
this.nodeChecked$.next(new tree_events_1.NodeCheckedEvent(tree));
};
TreeService.prototype.fireNodeUnchecked = function (tree) {
this.nodeUnchecked$.next(new tree_events_1.NodeUncheckedEvent(tree));
};
TreeService.prototype.fireNodeIndeterminate = function (tree, indeterminate) {
this.nodeIndeterminate$.next(new tree_events_1.NodeIndeterminateEvent(tree, indeterminate));
};
TreeService.prototype.draggedStream = function (tree, element) {
return this.nodeDraggableService.draggableNodeEvents$.pipe(operators_1.filter(function (e) { return e.target === element; }), operators_1.filter(function (e) { return !e.captured.some(function (cn) { return cn.tree.hasChild(tree); }); }));
};
TreeService.prototype.setController = function (id, controller) {
this.controllers.set(id, controller);
};
TreeService.prototype.deleteController = function (id) {
if (this.controllers.has(id)) {
this.controllers.delete(id);
}
};
TreeService.prototype.getController = function (id) {
if (this.controllers.has(id)) {
return this.controllers.get(id);
}
return null;
};
TreeService.prototype.hasController = function (id) {
return this.controllers.has(id);
};
TreeService.prototype.shouldFireLoadNextLevel = function (tree) {
var shouldLoadNextLevel = tree.node.emitLoadNextLevel &&
!tree.node.loadChildren &&
!tree.childrenAreBeingLoaded() &&
fn_utils_1.isEmpty(tree.children);
if (shouldLoadNextLevel) {
tree.loadingChildrenRequested();
}
return shouldLoadNextLevel;
};
TreeService.ɵfac = function TreeService_Factory(t) { return new (t || TreeService)(i0.ɵɵinject(node_draggable_service_1.NodeDraggableService)); };
TreeService.ɵprov = i0.ɵɵdefineInjectable({ token: TreeService, factory: TreeService.ɵfac });
return TreeService;
}());
exports.TreeService = TreeService;
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TreeService, [{
type: core_1.Injectable
}], function () { return [{ type: i1.NodeDraggableService, decorators: [{
type: core_1.Inject,
args: [node_draggable_service_1.NodeDraggableService]
}] }]; }, null); })();
//# sourceMappingURL=tree.service.js.map
|
"use strict";
const notifyBundleValid = require("../util/notify-bundle-valid");
/* eslint max-statements: 0 */
function webpackDevReporter(reporterOptions) {
const state = reporterOptions.state;
const stats = reporterOptions.stats;
const options = reporterOptions.options;
const logger = require("@xarc/app/lib/logger");
if (state) {
let displayStats = !options.quiet && options.stats !== false;
if (displayStats && !(stats.hasErrors() || stats.hasWarnings()) && options.noInfo) {
displayStats = false;
}
if (displayStats) {
logger.info(stats.toString(options.stats));
}
if (!options.noInfo && !options.quiet) {
let errMsg = ".";
if (!stats.hasErrors()) {
notifyBundleValid();
} else {
errMsg = " but there were errors.";
}
logger.info(`webpack: bundle is now VALID ${errMsg}`);
}
} else {
logger.info("webpack: bundle is now INVALID.");
}
}
module.exports = webpackDevReporter;
|
/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* 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.
*/
'use strict';
var isEven = require( '@stdlib/assert-is-even' ).isPrimitive;
var randu = require( '@stdlib/random-base-randu' );
var floor = require( '@stdlib/math-base-special-floor' );
var doUntilEach = require( './../lib' );
function predicate( value ) {
return ( value !== value );
}
function log( value, index, collection ) {
console.log( '%s: %d', index, value );
if ( isEven( index ) ) {
collection.shift();
} else {
collection.push( index+1 );
}
}
var arr;
var j;
var i;
arr = new Array( 100 );
j = floor( randu()*arr.length );
for ( i = 0; i < arr.length; i++ ) {
if ( i === j ) {
arr[ i ] = NaN;
} else {
arr[ i ] = i;
}
}
doUntilEach( arr, log, predicate );
|
const ContextBuilder = require('../../context/context-builder');
const vm = require('vm');
const HELP = `loads the appx module at the specified path.`;
const parser = require('yargs/yargs')(process.argv.slice(2))
.example('.loadModule ~/modules/MyModule',
'Loads the module at the path into the current REPL session.')
.exitProcess(false)
.help();
const LoadModuleCommand = (server) => {
return {
help: HELP,
action: function(argv) {
this.lineParser.reset();
this.bufferedCommand = '';
const parsed = parseArgs(argv);
if (parsed.help) {
this.displayPrompt();
return;
}
if (!parsed.isValid) {
usage.call(this, parsed.validationMsg);
return;
}
const path = parsed.path;
putScope.call(this, server, path);
this.displayPrompt();
}
};
};
function putScope(server, pathToScope) {
const appxContext = new ContextBuilder()
.forNamedResource(pathToScope)
.build();
const code = appxContext.getCode();
if (!code) {
usage.call(this, `No code found at ${path}`);
return;
}
const digests = appxContext.getDigests();
const script = vm.createScript(code);
const sandbox = {};
script.runInNewContext(sandbox);
server.putAppXScope(sandbox, digests);
}
function parseArgs(argv) {
const parsed = parser.parse(argv);
parsed.isValid = true;
const path = parsed._;
parsed.path = path;
if (!path || !path.length) {
parsed.isValid = false;
parsed.validationMsg = `Hmmm...${path} doesn't look like a path`;
} else if (Array.isArray(path)) {
if (path.length > 1) {
parsed.isValid = false;
parsed.validationMsg = 'Please specify only one module';
} else {
parsed.path = path[0];
}
}
return parsed;
}
function usage(msg) {
if (!msg) {
msg = HELP;
}
console.log(msg);
this.displayPrompt();
}
module.exports = LoadModuleCommand;
|
import React, { Component } from 'react';
import { Button, Glyphicon } from 'react-bootstrap';
import DateRangePicker from 'react-bootstrap-daterangepicker';
import Util from './Util'
const moment = require('moment');
const Fetching = Util.Fetching;
class News extends Component {
constructor(props) {
super(props);
this.fetchNews = this.fetchNews.bind(this);
this.onDateSet = this.onDateSet.bind(this);
this.state = {
news: [],
startDate: props.startDate,
endDate: props.endDate || '2017-07-19',
fetching: false
}
}
componentDidMount() {
this.fetchNews();
}
render() {
let label;
let dateSel = this.props.dateSel;
if(dateSel){
let start = this.state.startDate;
let end = this.state.endDate;
label = start + ' - ' + end;
if (start === end) label = start;
}
return(
<div id="news-panel" className="row">
<h2>{dateSel || 'Recent '}Market News</h2>
{dateSel && <div>
<DateRangePicker startDate={moment(this.state.startDate)} endDate={moment(this.state.endDate)} onApply={this.onDateSet}>
<Button className="selected-date-range-btn">
<div className="pull-left"><Glyphicon glyph="calendar" /> <span>{label}</span> <span className="caret"/></div>
</Button>
</DateRangePicker>
<br/>
</div>}
<br/>
{this.state.fetching ? (<Fetching resource='News'/>) : newsStories(this.state.news, this.props.full)}
</div>
);
}
async onDateSet(event, picker) {
await this.setState({
startDate: picker.startDate.format('YYYY-MM-DD'),
endDate: picker.endDate.format('YYYY-MM-DD')
});
this.fetchNews();
}
fetchNews() {
this.setState({fetching: true});
let startDateParam = this.state.startDate ? 'startDate='+this.state.startDate : '';
let endDateParam = this.state.endDate ? 'endDate='+this.state.endDate : '';
let maxParam = this.props.max ? 'max='+this.props.max : '';
let newsApiUrl = '/api/stocks/news?'+startDateParam+'&'+endDateParam+'&'+maxParam;
fetch(newsApiUrl)
.then(res => res.json())
.then(news => this.setState({news: news, fetching: false}))
.catch((error) => { console.error(error); });
}
}
function newsStories(news_data, full) {
return news_data.map((story, i) =>
<div key={'story-' + i} className={full && "col-md-4 col-sm-6"}>
<div className="panel panel-default">
<div className="panel-heading" style={{height: 90}}>
<p className="align-left">{(new Date(story['NEWS_DATE'])).toString().slice(4, 16)}</p>
<h3 className="panel-title">
{story['NEWS_TITLE'].length > 80 ? story['NEWS_TITLE'].slice(0, 80) + '...' : story['NEWS_TITLE']}
</h3>
</div>
<div className="panel-body">
<p className="align-left">{story['NEWS_TEXT'].slice(0, 200) + '...'}</p>
</div>
<div className="panel-footer">
Source: <strong><a href={story['NEWS_URL']} target="_blank" rel="noopener noreferrer">
{story['NEWS_SRC']} <Glyphicon glyph='new-window'/></a></strong>
</div>
</div>
</div>
);
}
export default News;
|
import styles from './template.css';
import template from './template';
import AoflElement from '@aofl/web-components/aofl-element';
/**
* @summary IconTwotoneWifiOffElement
* @class IconTwotoneWifiOffElement
* @extends {AoflElement}
*/
class IconTwotoneWifiOffElement extends AoflElement {
/**
* Creates an instance of IconTwotoneWifiOffElement.
*/
constructor() {
super();
}
/**
* @readonly
*/
static get is() {
return 'icon-twotone-wifi-off';
}
/**
*
* @return {Object}
*/
render() {
return super.render(template, [styles]);
}
}
window.customElements.define(IconTwotoneWifiOffElement.is, IconTwotoneWifiOffElement);
export default IconTwotoneWifiOffElement;
|
const buttons = document.querySelectorAll('.delete-comment');
buttons.forEach(button => {
button.addEventListener('click', commentPageHandler);
})
async function commentPageHandler(event) {
event.preventDefault();
const id = event.target.name;
const response = await fetch(`/api/comments/${id}`, {
method: 'DELETE'
});
if (response.ok) {
document.location.reload();
} else {
alert(response.statusText);
}
}
|
/**
* Copyright 2016 The AMP HTML Authors. All Rights Reserved.
*
* 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 {adopt} from '../../../../src/runtime';
import {createIframePromise} from '../../../../testing/iframe';
import * as sinon from 'sinon';
import '../amp-social-share';
import {platformFor} from '../../../../src/platform';
adopt(window);
const STRINGS = {
'text': 'Hello world',
'url': 'https://example.com/',
'attribution': 'AMPhtml',
'text-too-long': 'Hello world, Hello world, Hello world, Hello world, Hello' +
'world, Hello world, Hello world, Hello world, Hello world, Hello world, ' +
'Hello world',
};
describe('amp-social-share', () => {
let sandbox;
let platform;
let isIos = false;
let isSafari = false;
function getShare(type, opt_endpoint, opt_params) {
return getCustomShare(iframe => {
sandbox.stub(iframe.win, 'open').returns(true);
const share = iframe.doc.createElement('amp-social-share');
share.addEventListener = sandbox.spy();
if (opt_endpoint) {
share.setAttribute('data-share-endpoint', opt_endpoint);
}
for (const key in opt_params) {
share.setAttribute('data-param-' + key, opt_params[key]);
}
share.setAttribute('type', type);
share.setAttribute('width', 60);
share.setAttribute('height', 44);
return share;
});
}
function getCustomShare(modifier) {
return createIframePromise().then(iframe => {
platform = platformFor(iframe.win);
sandbox.stub(platform, 'isIos', () => isIos);
sandbox.stub(platform, 'isSafari', () => isSafari);
const canonical = iframe.doc.createElement('link');
iframe.doc.title = 'doc title';
canonical.setAttribute('rel', 'canonical');
canonical.setAttribute('href', 'https://canonicalexample.com/');
iframe.addElement(canonical);
return iframe.addElement(modifier(iframe));
});
}
beforeEach(() => {
sandbox = sinon.sandbox.create();
isIos = false;
isSafari = false;
});
afterEach(() => {
sandbox.restore();
});
it('errors if share endpoint is missing', () => {
return createIframePromise().then(iframe => {
const share = iframe.doc.createElement('amp-social-share');
share.setAttribute('type', 'unknown-provider');
expect(() => {
share.tryUpgrade_();
share.build(true);
}).to.throw('data-share-endpoint attribute is required');
});
});
it('errors if type is missing', () => {
return createIframePromise().then(iframe => {
const share = iframe.doc.createElement('amp-social-share');
expect(() => {
share.tryUpgrade_();
share.build(true);
}).to.throw('type attribute is required');
});
});
it('errors if type has space characters', () => {
return createIframePromise().then(iframe => {
const share = iframe.doc.createElement('amp-social-share');
share.setAttribute('type', 'hello world');
expect(() => {
share.tryUpgrade_();
share.build(true);
}).to.throw('Space characters are not allowed in type attribute value');
});
});
it('renders unconfigured providers if share endpoint provided', () => {
return getCustomShare(iframe => {
const share = iframe.doc.createElement('amp-social-share');
share.setAttribute('type', 'unknown-provider');
share.setAttribute('data-share-endpoint',
'https://exampleprovider.com/share/');
share.setAttribute('data-param-text', 'check out: CANONICAL_URL');
return share;
}).then(el => {
expect(el.implementation_.params_.text).to.be.equal(
'check out: CANONICAL_URL');
expect(el.implementation_.href_).to.not.contain(
encodeURIComponent('CANONICAL_URL'));
expect(el.implementation_.href_).to.contain(
encodeURIComponent('https://canonicalexample.com/'));
expect(el.implementation_.shareEndpoint_).to.be.equal(
'https://exampleprovider.com/share/');
});
});
it('renders twitter', () => {
const params = {
'url': STRINGS['url'],
'via': STRINGS['attribution'],
};
return getShare('twitter', /* endpoint */ undefined, params).then(el => {
expect(el.implementation_.params_.text).to.be.equal('TITLE');
expect(el.implementation_.params_.url).to.be.equal('https://example.com/');
expect(el.implementation_.params_.via).to.be.equal('AMPhtml');
expect(el.implementation_.shareEndpoint_).to.be.equal(
'https://twitter.com/intent/tweet');
expect(el.implementation_.href_).to.not.contain('TITLE');
expect(el.addEventListener).to.be.calledOnce;
expect(el.addEventListener).to.be.calledWith('click');
});
});
it('adds a default value for url', () => {
return getCustomShare(iframe => {
const share = iframe.doc.createElement('amp-social-share');
share.setAttribute('type', 'twitter');
share.setAttribute('width', 60);
share.setAttribute('height', 44);
return share;
}).then(el => {
expect(el.implementation_.params_.url).to.be.equal('CANONICAL_URL');
expect(el.implementation_.href_).to.not.contain(
encodeURIComponent('CANONICAL_URL'));
expect(el.implementation_.href_).to.contain(
encodeURIComponent('https://canonicalexample.com/'));
expect(el.implementation_.shareEndpoint_).to.be.equal(
'https://twitter.com/intent/tweet');
});
});
it('opens share window in _blank', () => {
return getShare('twitter').then(el => {
el.implementation_.handleClick_();
expect(el.implementation_.win.open).to.be.calledOnce;
expect(el.implementation_.win.open).to.be.calledWith(
'https://twitter.com/intent/tweet?text=doc%20title&' +
'url=https%3A%2F%2Fcanonicalexample.com%2F',
'_blank', 'resizable,scrollbars,width=640,height=480'
);
});
});
it('opens mailto: window in _top on iOS Safari', () => {
isIos = true;
isSafari = true;
return getShare('email').then(el => {
el.implementation_.handleClick_();
expect(el.implementation_.win.open).to.be.calledOnce;
expect(el.implementation_.win.open).to.be.calledWith(
'mailto:?subject=doc%20title&' +
'body=https%3A%2F%2Fcanonicalexample.com%2F',
'_top', 'resizable,scrollbars,width=640,height=480'
);
});
});
});
|
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
var callbackPass = chrome.test.callbackPass;
var callbackFail = chrome.test.callbackFail;
var assertTrue = chrome.test.assertTrue;
var assertEq = chrome.test.assertEq;
// Test properties for the verification API.
var verificationProperties = {
certificate: 'certificate',
intermediateCertificates: ['ica1', 'ica2', 'ica3'],
publicKey: 'cHVibGljX2tleQ==', // Base64('public_key')
nonce: 'nonce',
signedData: 'c2lnbmVkX2RhdGE=', // Base64('signed_data')
deviceSerial: 'device_serial',
deviceSsid: 'Device 0123',
deviceBssid: '00:01:02:03:04:05'
};
chrome.test.getConfig(function(config) {
var args = JSON.parse(config.customArg);
chrome.test.runTests([
function verifyDestination() {
chrome.networking.castPrivate.verifyDestination(
verificationProperties,
callbackPass(function(isValid) {
assertTrue(isValid);
}));
},
function verifyAndEncryptCredentials() {
var networkGuid = 'wifi_guid';
chrome.networking.castPrivate.verifyAndEncryptCredentials(
verificationProperties,
networkGuid,
callbackPass(function(result) {
assertEq('encrypted_credentials', result);
}));
},
function verifyAndEncryptData() {
chrome.networking.castPrivate.verifyAndEncryptData(
verificationProperties,
'data',
callbackPass(function(result) {
assertEq('encrypted_data', result);
}));
},
function setWifiTDLSEnabledState() {
if (args.tdlsSupported) {
chrome.networking.castPrivate.setWifiTDLSEnabledState(
'aa:bb:cc:dd:ee:ff', true, callbackPass(function(result) {
assertEq('CONNECTED', result);
}));
} else {
chrome.networking.castPrivate.setWifiTDLSEnabledState(
'aa:bb:cc:dd:ee:ff', true, callbackFail('Not supported'));
}
},
function getWifiTDLSStatus() {
if (args.tdlsSupported) {
chrome.networking.castPrivate.getWifiTDLSStatus(
'aa:bb:cc:dd:ee:ff', callbackPass(function(result) {
assertEq('CONNECTED', result);
}));
} else {
chrome.networking.castPrivate.getWifiTDLSStatus(
'aa:bb:cc:dd:ee:ff', callbackFail('Not supported'));
}
},
]);
});
|
/*
* Copyright (c) BrownBear, 2018 - Present. All Rights Reserved.
*
* This file is a part of Tuleap.
*
* Tuleap is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Tuleap is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Tuleap. If not, see <http://www.gnu.org/licenses/>.
*/
import Gettext from "node-gettext";
import french_translations from "../po/fr.po";
const gettext_provider = new Gettext();
gettext_provider.addTranslations("fr_FR", "graphontrackersv5", french_translations);
gettext_provider.setTextDomain("graphontrackersv5");
export { gettext_provider };
|
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _ApiClient = _interopRequireDefault(require("../ApiClient"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
/**
* The PropertyKey model module.
* @module model/PropertyKey
* @version 1.4.0
*/
var PropertyKey = /*#__PURE__*/function () {
/**
* Constructs a new <code>PropertyKey</code>.
* Property key details.
* @alias module:model/PropertyKey
*/
function PropertyKey() {
_classCallCheck(this, PropertyKey);
PropertyKey.initialize(this);
}
/**
* Initializes the fields of this object.
* This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
* Only for internal use.
*/
_createClass(PropertyKey, null, [{
key: "initialize",
value: function initialize(obj) {}
/**
* Constructs a <code>PropertyKey</code> from a plain JavaScript object, optionally creating a new instance.
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
* @param {Object} data The plain JavaScript object bearing properties of interest.
* @param {module:model/PropertyKey} obj Optional instance to populate.
* @return {module:model/PropertyKey} The populated <code>PropertyKey</code> instance.
*/
}, {
key: "constructFromObject",
value: function constructFromObject(data, obj) {
if (data) {
obj = obj || new PropertyKey();
if (data.hasOwnProperty('key')) {
obj['key'] = _ApiClient["default"].convertToType(data['key'], 'String');
}
if (data.hasOwnProperty('self')) {
obj['self'] = _ApiClient["default"].convertToType(data['self'], 'String');
}
}
return obj;
}
}]);
return PropertyKey;
}();
/**
* The key of the property.
* @member {String} key
*/
PropertyKey.prototype['key'] = undefined;
/**
* The URL of the property.
* @member {String} self
*/
PropertyKey.prototype['self'] = undefined;
var _default = PropertyKey;
exports["default"] = _default;
|
var UITree = function () {
var handleBiblioteca = function () {
$('.tree_biblioteca').each(function(index, element) {
$(this).jstree({
'plugins': ["wholerow","html_data", "checkbox", "types"],
"checkbox" : {
"keep_selected_style" : false,
"three_state":true
},
'core': {
"themes" : {
"responsive": false,
"icons": false
}
},
"types" : {
"default" : {
"icon" : "fa fa-folder icon-state-warning icon-lg"
},
"file" : {
"icon" : "fa fa-file icon-state-warning icon-lg"
}
}
});
});
$('.tree_biblioteca a.jstree-anchor').on('focus', function() {
console.log($('.tree_biblioteca').jstree(true).get_selected());
});
$('.tree_biblioteca').each(function(index, elementtree) {
var id_current = $(this).attr("data-id");
$(this).on('changed.jstree', function (e, data) {
var i, j, r = [];
for (i = 0, j = data.selected.length; i < j; i++) {
//console.log(data.instance.get_node(data.selected[i]).data.cat);
r.push(data.instance.get_node(data.selected[i]).data.cat);
}
// nodos adicionales
var checked_ids = [];
setTimeout(function() {
$(elementtree).find(".jstree-undetermined").each(function (i, element) {
// alert($(element).closest('.jstree-node').attr("data-cat"));
if ( !( $(element).closest('.jstree-node').attr("data-cat") in checked_ids ) ) {
checked_ids.push( $(element).closest('.jstree-node').attr("data-cat"));
}
});
console.log("checked_ids");
console.log(checked_ids);
$("#categoriasv2_"+id_current).val(r.join(',')+","+checked_ids.join(','));
},300);
});
});
$('.tree_biblioteca').each(function(index, element) {
$(this).jstree(true).open_all();
});
var nodeids = Array();
var nodeids_uncheck = Array();
$('.tree_biblioteca li').each(function() {
// console.log($(this).data("checkstate")+'::'+$(this).attr("id"));
if ($(this).data("checkstate") == "checked") {
nodeids.push($(this).attr("id"));
}
});
$('.tree_biblioteca').each(function(index, element) {
$(this).jstree(true).close_all();
});
// other way
//var nodeids = ["01", "02"];
$(".tree_biblioteca").each(function(index, element) {
$(this).jstree(true).check_node(nodeids);
});
$('.tree_biblioteca li').each(function() {
// console.log($(this).data("checkstate")+'::'+$(this).attr("id"));
if ($(this).data("checkstate") != "checked") {
//$('#tree_2').jstree('uncheck_node',$(this).attr("id"));
console.log($(".tree_biblioteca").jstree().get_node($(this).attr("id"))._get_children);
// $("#tree_2").jstree(true).deselect_node($(this).attr("id"));;
}
});
var selected=$(".tree_biblioteca").jstree('get_selected');
console.log(selected);
// end other way
}
return {
//main function to initiate the module
init: function () {
handleBiblioteca();
}
};
}();
jQuery(document).ready(function() {
UITree.init();
});
|
//二维码相关的内容
//参考自 https://github.com/johansten/stargazer/blob/master/docs/qr-codes.md
// 生成名片信息(用于生成二维码)
// json数据格式
import StellarSdk from 'stellar-sdk'
export function exportNameCard(account){
let data = {
"stellar": {
"account": {
"name":account.name, //账户名称
"id": account.address, //地址
"fed": account.federationAddress, //联邦地址
"memo": account.memo,//备注
}
}
}
return JSON.stringify(data)
}
// 导出账户,包括公私钥信息
export function exportAccount(account,accountData){
let data = {
"stellar": {
"account": {
"name":account.name, //账户名称
//id: account.address, //地址
//"fed": account.federationAddress, //联绑地址
//"inflate": account.inflationAddress,//通账地址
"memo": account.memo,//备注
},
"key": accountData.seed // 私钥地址
}
}
let firefly = JSON.stringify(data)
console.log(firefly)
return firefly
}
export function exportPayment(account,amount,asset_code,asset_issuer,memo_type,memo){
let data = {
"stellar": {
"payment": {
"destination": account.address,
//"network": NETWORK_CODE, // (*)
"amount": amount,
"asset": { // (**)
"code": asset_code,
"issuer": asset_issuer
},
"memo": {
"type": memo_type,
"value": memo
}
}
}
}
return JSON.stringify(data)
}
export function importContact(data){
if(data === null)return {status: false}
if(typeof data === 'undefined')return {status: false}
if(typeof data === 'object'){
return getContactFromJSON(jsondata)
}
if(typeof data === 'string'){
data = data.trim()
try{
var jsondata = JSON.parse(data)
return getContactFromJSON(jsondata)
}catch(e){
let ok = StellarSdk.StrKey.isValidEd25519PublicKey(data)
if(ok){
return {status: true, ret: {stellar_id:data}}
}
}
}
return { status: false }
}
function getContactFromJSON(data){
console.log(data)
console.log(typeof data)
let account = data.stellar.account
if(account){
// stargaze格式
let name = account.name //contact name
let stellar_id = account.id //contact address
let federationAddress = account.fed //contact federation address default is null
let memo_type = account.memoType // contact memo type ,default is null
let memo = account.memo //contact memo default is null
if(stellar_id){
return {status: true, ret: {name,stellar_id,federationAddress,memo_type,memo}}
}
}
return {status:false}
}
/**
* 导入账户
* 1. 直接导入私钥
* 2. 导入的是stargaze的账户类型
*/
export function importAccountFromData(data){
if(data === null)return {status: false}
if(typeof data === 'undefined')return {status: false}
if(typeof data === 'object'){
return getSeedFromJSON(jsondata)
}
if(typeof data === 'string'){
data = data.trim()
try{
var jsondata = JSON.parse(data)
return getSeedFromJSON(jsondata)
}catch(e){
console.error(e)
let ok = StellarSdk.StrKey.isValidEd25519SecretSeed(data)
if(ok){
return {status: true, seed: data}
}
}
}
return { status: false }
}
function getSeedFromJSON(data){
let stellar = data.stellar
if(stellar){
// stargaze格式
let seed = stellar.key
if(seed){
return {status: true, seed, data}
}
}
return {status:false}
}
|
const Query = require('./query');
const Mutation = require('./mutation');
const { GraphQLDateTime } = require('graphql-iso-date')
module.exports = {
Query,
Mutation,
DateTime: GraphQLDateTime,
};
|
import React from "react";
// import { CartItemStateContext } from "../../context/CartItemContext";
import ProductsListing from "../../components/ProductsListing";
import Cart from "../../components/Cart";
import withLayout from "../../hoc/withLayout";
function Home({ isLoading, hasError, loadingError }) {
// const { cartItems } = useContext(CartItemStateContext);
return (
<div className="row">
<div className="col col-8">
<div className="row">
<div className="col col-12">
<header className="jumbotron">
<h1 className="display-4">Shoe shop</h1>
<p className="lead">
This is the best shoe shop ever, you will never find a better
one.
</p>
<p className="font-weight-bold">Buy now!</p>
</header>
</div>
{isLoading && (
<div className="col col-12">
<h2>Loading products...</h2>
</div>
)}
{hasError && (
<div className="col col-12">
<h2>Something went wrong...</h2>
<pre>
<code>{loadingError}</code>
</pre>
</div>
)}
{!isLoading && !hasError && (
<div className="col col-12">
<ProductsListing />
</div>
)}
</div>
</div>
<Cart className="col col-4" />
</div>
);
}
export default withLayout(Home);
|
var path = require('path');
var express = require('express');
var exphbs = require('../../..');
var app = express();
app.engine('hbs', exphbs.create());
app.set('view engine', 'hbs');
app.set('views', path.join(__dirname, 'views'));
app.get('/', function(req, res) {
res.render('index', {
google: {
url: 'http://www.google.com/',
text: 'Google'
}
});
});
module.exports = app;
|
module.exports={D:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.005809,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0.023236,"23":0,"24":0.005809,"25":0,"26":0.005809,"27":0,"28":0,"29":0.023236,"30":0,"31":0,"32":0.005809,"33":0,"34":0.011618,"35":0,"36":0,"37":0.005809,"38":0.017427,"39":0.011618,"40":0.005809,"41":0.005809,"42":0.005809,"43":0.005809,"44":0,"45":0.005809,"46":0.005809,"47":0.005809,"48":0.005809,"49":0.156843,"50":0.005809,"51":0.011618,"52":0.017427,"53":0.011618,"54":0.029045,"55":0.029045,"56":0.017427,"57":0.017427,"58":0.029045,"59":0.029045,"60":0.023236,"61":0.435675,"62":0.081326,"63":0.17427,"64":0.092944,"65":0.29045,"66":0.063899,"67":0.069708,"68":0.075517,"69":0.092944,"70":0.214933,"71":4.885369,"72":6.471226,"73":0.063899,"74":0.005809,"75":0},C:{"2":0,"3":0.005809,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0.017427,"23":0,"24":0.005809,"25":0,"26":0.034854,"27":0,"28":0,"29":0.005809,"30":0,"31":0.005809,"32":0,"33":0.005809,"34":0.011618,"35":0,"36":0,"37":0.005809,"38":0.11618,"39":0.005809,"40":0.005809,"41":0.005809,"42":0.011618,"43":0.011618,"44":0.005809,"45":0.029045,"46":0.005809,"47":0.023236,"48":0.081326,"49":0.011618,"50":0.017427,"51":0.023236,"52":0.284641,"53":0.011618,"54":0.034854,"55":0.017427,"56":0.052281,"57":0.052281,"58":0.046472,"59":0.034854,"60":0.412439,"61":0.087135,"62":0.05809,"63":0.087135,"64":1.092092,"65":5.477887,"66":0.034854,"67":0,"3.5":0,"3.6":0.005809},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0.005809,"32":0.005809,"33":0,"34":0,"35":0,"36":0.017427,"37":0,"38":0.005809,"39":0,"40":0.005809,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0.005809,"47":0,"48":0.005809,"49":0.011618,"50":0.005809,"51":0.005809,"52":0,"53":0,"54":0,"55":0,"56":0.017427,"57":0.447293,"58":0.487956,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0.011618},E:{"4":0.011618,"5":0.011618,"6":0,"7":0.011618,"8":0.046472,"9":0.017427,"10":0.023236,"11":0.069708,"12":1.7427,_:"0","3.1":0,"3.2":0,"5.1":0.023236,"6.1":0.017427,"7.1":0.005809,"9.1":0.052281,"10.1":0.121989,"11.1":0.267214,"12.1":0.005809},G:{"8":0.59252492905034,"3.2":0.0084345185629941,"4.0-4.1":0.0063258889222456,"4.2-4.3":0.0063258889222456,"5.0-5.1":0.023194926048234,"6.0-6.1":0.01476040748524,"7.0-7.1":0.048498481737216,"8.1-8.4":0.11597463024117,"9.0-9.2":0.061150259581707,"9.3":0.45124674312018,"10.0-10.2":0.2825563718603,"10.3":0.58619904012809,"11.0-11.2":0.76543255959171,"11.3-11.4":1.8345077874512,"12.0-12.1":16.196384270589,"12.2":0.078019296707695},I:{"3":0.0012015035460993,"4":0.15979997163121,_:"67","2.1":0,"2.2":0,"2.3":0.026433078014184,"4.1":0.045657134751773,"4.2-4.3":0.24150221276596,"4.4":0,"4.4.3-4.4.4":0.54187809929078},A:{"6":0.047054112734864,"7":0.005881764091858,"8":0.070581169102296,"9":0.035290584551148,"10":0.052935876826722,"11":2.6056214926931,"5.5":0},B:{"12":0.005809,"13":0.011618,"14":0.046472,"15":0.069708,"16":0.139416,"17":1.667183,_:"18"},K:{_:"0 10 11 12 11.1 11.5 12.1"},P:{"4":0.48875731034483,"5.0-5.4":0.095626430284858,"6.2-6.4":0.085001271364318,_:"7.2-7.4 8.2"},N:{"10":0,"11":0.104775},J:{"7":0.0033528,"10":0.0134112},R:{_:"0"},M:{"0":0.578358},O:{"0":0.205359},Q:{_:"1.2"},H:{"0":0.30155037113402},L:{"0":34.209441}};
|
var helicopterIMG, helicopterSprite, packageSprite,packageIMG;
var packageBody,ground,rect1
const Engine = Matter.Engine;
const World = Matter.World;
const Bodies = Matter.Bodies;
const Body = Matter.Body;
function preload()
{
helicopterIMG=loadImage("helicopter.png")
packageIMG=loadImage("package.png")
}
function setup() {
createCanvas(800, 700);
rectMode(CENTER);
packageSprite=createSprite(width/2, 80, 10,10);
packageSprite.addImage(packageIMG)
packageSprite.scale=0.2
helicopterSprite=createSprite(width/2, 200, 10,10);
helicopterSprite.addImage(helicopterIMG)
helicopterSprite.scale=0.6
groundSprite=createSprite(width/2, height-35, width,10);
groundSprite.shapeColor=color(255)
engine = Engine.create();
world = engine.world;
packageBody = Bodies.circle(width/2 , 200 , 5 , {restitution:0, isStatic:true});
World.add(world, packageBody);
red1 = createSprite(400,650,200,20);
red1.shapeColor = "red";
red2 = createSprite(300,610,20,100);
red2.shapeColor = "red";
red3 = createSprite(500,610,20,100);
red3.shapeColor = "red";
//Create a Ground
ground = Bodies.rectangle(width/2, 650, width, 10 , {isStatic:true} );
World.add(world, ground);
Engine.run(engine);
}
function draw() {
rectMode(CENTER);
background(0);
packageSprite.x= packageBody.position.x
packageSprite.y= packageBody.position.y
drawSprites();
keyPressed();
if(packageBody.position.y >= 600) {
Matter.Body.setStatic(packageBody, true);
}
}
function keyPressed() {
if (keyDown("DOWN_ARROW")) {
packageBody = Bodies.circle(width/2 , 200 , 5 , {restitution:0, isStatic:false});
World.add(world, packageBody);
}
}
|
define({"topics" : [{"title":"Supported Stages","href":"datacollector\/UserGuide\/Pipeline_Configuration\/Expressions.html#concept_bs3_dm5_3cb","attributes": {"data-id":"concept_bs3_dm5_3cb",},"menu": {"hasChildren":false,},"tocID":"concept_bs3_dm5_3cb-d46e41559","topics":[]},{"title":"Field Path Expression Syntax","href":"datacollector\/UserGuide\/Pipeline_Configuration\/Expressions.html#concept_nhd_5p5_3cb","attributes": {"data-id":"concept_nhd_5p5_3cb",},"menu": {"hasChildren":false,},"tocID":"concept_nhd_5p5_3cb-d46e41631","topics":[]}]});
|
/*! WOW - v1.1.3 - 2016-05-06
* Copyright (c) 2016 Matthieu Aussaguel;*/(function(){var a,b,c,d,e,f=function(a,b){return function(){return a.apply(b,arguments)}},g=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1};b=function(){function a(){}return a.prototype.extend=function(a,b){var c,d;for(c in b)d=b[c],null==a[c]&&(a[c]=d);return a},a.prototype.isMobile=function(a){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(a)},a.prototype.createEvent=function(a,b,c,d){var e;return null==b&&(b=!1),null==c&&(c=!1),null==d&&(d=null),null!=document.createEvent?(e=document.createEvent("CustomEvent"),e.initCustomEvent(a,b,c,d)):null!=document.createEventObject?(e=document.createEventObject(),e.eventType=a):e.eventName=a,e},a.prototype.emitEvent=function(a,b){return null!=a.dispatchEvent?a.dispatchEvent(b):b in(null!=a)?a[b]():"on"+b in(null!=a)?a["on"+b]():void 0},a.prototype.addEvent=function(a,b,c){return null!=a.addEventListener?a.addEventListener(b,c,!1):null!=a.attachEvent?a.attachEvent("on"+b,c):a[b]=c},a.prototype.removeEvent=function(a,b,c){return null!=a.removeEventListener?a.removeEventListener(b,c,!1):null!=a.detachEvent?a.detachEvent("on"+b,c):delete a[b]},a.prototype.innerHeight=function(){return"innerHeight"in window?window.innerHeight:document.documentElement.clientHeight},a}(),c=this.WeakMap||this.MozWeakMap||(c=function(){function a(){this.keys=[],this.values=[]}return a.prototype.get=function(a){var b,c,d,e,f;for(f=this.keys,b=d=0,e=f.length;e>d;b=++d)if(c=f[b],c===a)return this.values[b]},a.prototype.set=function(a,b){var c,d,e,f,g;for(g=this.keys,c=e=0,f=g.length;f>e;c=++e)if(d=g[c],d===a)return void(this.values[c]=b);return this.keys.push(a),this.values.push(b)},a}()),a=this.MutationObserver||this.WebkitMutationObserver||this.MozMutationObserver||(a=function(){function a(){"undefined"!=typeof console&&null!==console&&console.warn("MutationObserver is not supported by your browser."),"undefined"!=typeof console&&null!==console&&console.warn("WOW.js cannot detect dom mutations, please call .sync() after loading new content.")}return a.notSupported=!0,a.prototype.observe=function(){},a}()),d=this.getComputedStyle||function(a,b){return this.getPropertyValue=function(b){var c;return"float"===b&&(b="styleFloat"),e.test(b)&&b.replace(e,function(a,b){return b.toUpperCase()}),(null!=(c=a.currentStyle)?c[b]:void 0)||null},this},e=/(\-([a-z]){1})/g,this.WOW=function(){function e(a){null==a&&(a={}),this.scrollCallback=f(this.scrollCallback,this),this.scrollHandler=f(this.scrollHandler,this),this.resetAnimation=f(this.resetAnimation,this),this.start=f(this.start,this),this.scrolled=!0,this.config=this.util().extend(a,this.defaults),null!=a.scrollContainer&&(this.config.scrollContainer=document.querySelector(a.scrollContainer)),this.animationNameCache=new c,this.wowEvent=this.util().createEvent(this.config.boxClass)}return e.prototype.defaults={boxClass:"wow",animateClass:"animated",offset:0,mobile:!0,live:!0,callback:null,scrollContainer:null},e.prototype.init=function(){var a;return this.element=window.document.documentElement,"interactive"===(a=document.readyState)||"complete"===a?this.start():this.util().addEvent(document,"DOMContentLoaded",this.start),this.finished=[]},e.prototype.start=function(){var b,c,d,e;if(this.stopped=!1,this.boxes=function(){var a,c,d,e;for(d=this.element.querySelectorAll("."+this.config.boxClass),e=[],a=0,c=d.length;c>a;a++)b=d[a],e.push(b);return e}.call(this),this.all=function(){var a,c,d,e;for(d=this.boxes,e=[],a=0,c=d.length;c>a;a++)b=d[a],e.push(b);return e}.call(this),this.boxes.length)if(this.disabled())this.resetStyle();else for(e=this.boxes,c=0,d=e.length;d>c;c++)b=e[c],this.applyStyle(b,!0);return this.disabled()||(this.util().addEvent(this.config.scrollContainer||window,"scroll",this.scrollHandler),this.util().addEvent(window,"resize",this.scrollHandler),this.interval=setInterval(this.scrollCallback,50)),this.config.live?new a(function(a){return function(b){var c,d,e,f,g;for(g=[],c=0,d=b.length;d>c;c++)f=b[c],g.push(function(){var a,b,c,d;for(c=f.addedNodes||[],d=[],a=0,b=c.length;b>a;a++)e=c[a],d.push(this.doSync(e));return d}.call(a));return g}}(this)).observe(document.body,{childList:!0,subtree:!0}):void 0},e.prototype.stop=function(){return this.stopped=!0,this.util().removeEvent(this.config.scrollContainer||window,"scroll",this.scrollHandler),this.util().removeEvent(window,"resize",this.scrollHandler),null!=this.interval?clearInterval(this.interval):void 0},e.prototype.sync=function(b){return a.notSupported?this.doSync(this.element):void 0},e.prototype.doSync=function(a){var b,c,d,e,f;if(null==a&&(a=this.element),1===a.nodeType){for(a=a.parentNode||a,e=a.querySelectorAll("."+this.config.boxClass),f=[],c=0,d=e.length;d>c;c++)b=e[c],g.call(this.all,b)<0?(this.boxes.push(b),this.all.push(b),this.stopped||this.disabled()?this.resetStyle():this.applyStyle(b,!0),f.push(this.scrolled=!0)):f.push(void 0);return f}},e.prototype.show=function(a){return this.applyStyle(a),a.className=a.className+" "+this.config.animateClass,null!=this.config.callback&&this.config.callback(a),this.util().emitEvent(a,this.wowEvent),this.util().addEvent(a,"animationend",this.resetAnimation),this.util().addEvent(a,"oanimationend",this.resetAnimation),this.util().addEvent(a,"webkitAnimationEnd",this.resetAnimation),this.util().addEvent(a,"MSAnimationEnd",this.resetAnimation),a},e.prototype.applyStyle=function(a,b){var c,d,e;return d=a.getAttribute("data-wow-duration"),c=a.getAttribute("data-wow-delay"),e=a.getAttribute("data-wow-iteration"),this.animate(function(f){return function(){return f.customStyle(a,b,d,c,e)}}(this))},e.prototype.animate=function(){return"requestAnimationFrame"in window?function(a){return window.requestAnimationFrame(a)}:function(a){return a()}}(),e.prototype.resetStyle=function(){var a,b,c,d,e;for(d=this.boxes,e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(a.style.visibility="visible");return e},e.prototype.resetAnimation=function(a){var b;return a.type.toLowerCase().indexOf("animationend")>=0?(b=a.target||a.srcElement,b.className=b.className.replace(this.config.animateClass,"").trim()):void 0},e.prototype.customStyle=function(a,b,c,d,e){return b&&this.cacheAnimationName(a),a.style.visibility=b?"hidden":"visible",c&&this.vendorSet(a.style,{animationDuration:c}),d&&this.vendorSet(a.style,{animationDelay:d}),e&&this.vendorSet(a.style,{animationIterationCount:e}),this.vendorSet(a.style,{animationName:b?"none":this.cachedAnimationName(a)}),a},e.prototype.vendors=["moz","webkit"],e.prototype.vendorSet=function(a,b){var c,d,e,f;d=[];for(c in b)e=b[c],a[""+c]=e,d.push(function(){var b,d,g,h;for(g=this.vendors,h=[],b=0,d=g.length;d>b;b++)f=g[b],h.push(a[""+f+c.charAt(0).toUpperCase()+c.substr(1)]=e);return h}.call(this));return d},e.prototype.vendorCSS=function(a,b){var c,e,f,g,h,i;for(h=d(a),g=h.getPropertyCSSValue(b),f=this.vendors,c=0,e=f.length;e>c;c++)i=f[c],g=g||h.getPropertyCSSValue("-"+i+"-"+b);return g},e.prototype.animationName=function(a){var b;try{b=this.vendorCSS(a,"animation-name").cssText}catch(c){b=d(a).getPropertyValue("animation-name")}return"none"===b?"":b},e.prototype.cacheAnimationName=function(a){return this.animationNameCache.set(a,this.animationName(a))},e.prototype.cachedAnimationName=function(a){return this.animationNameCache.get(a)},e.prototype.scrollHandler=function(){return this.scrolled=!0},e.prototype.scrollCallback=function(){var a;return!this.scrolled||(this.scrolled=!1,this.boxes=function(){var b,c,d,e;for(d=this.boxes,e=[],b=0,c=d.length;c>b;b++)a=d[b],a&&(this.isVisible(a)?this.show(a):e.push(a));return e}.call(this),this.boxes.length||this.config.live)?void 0:this.stop()},e.prototype.offsetTop=function(a){for(var b;void 0===a.offsetTop;)a=a.parentNode;for(b=a.offsetTop;a=a.offsetParent;)b+=a.offsetTop;return b},e.prototype.isVisible=function(a){var b,c,d,e,f;return c=a.getAttribute("data-wow-offset")||this.config.offset,f=this.config.scrollContainer&&this.config.scrollContainer.scrollTop||window.pageYOffset,e=f+Math.min(this.element.clientHeight,this.util().innerHeight())-c,d=this.offsetTop(a),b=d+a.clientHeight,e>=d&&b>=f},e.prototype.util=function(){return null!=this._util?this._util:this._util=new b},e.prototype.disabled=function(){return!this.config.mobile&&this.util().isMobile(navigator.userAgent)},e}()}).call(this);
wow = new WOW(
{
boxClass: 'wow', // default
animateClass: 'animated', // default
offset: 0, // default
mobile: true, // default
live: true // default
}
)
wow.init();
|
var Download = function(table){
this.table = table; //hold Tabulator object
};
//trigger file download
Download.prototype.download = function(type, filename, options){
var self = this,
downloadFunc = false;
function buildLink(data, mime){
self.triggerDownload(data, mime, type, filename);
}
if(typeof type == "function"){
downloadFunc = type;
}else{
if(self.downloaders[type]){
downloadFunc = self.downloaders[type];
}else{
console.warn("Download Error - No such download type found: ", type);
}
}
if(downloadFunc){
downloadFunc(self.table.columnManager.getDefinitions(), self.table.rowManager.getData(true), options, buildLink);
}
};
Download.prototype.triggerDownload = function(data, mime, type, filename){
var element = document.createElement('a'),
blob = new Blob([data],{type:mime}),
filename = filename || "Tabulator." + (typeof type === "function" ? "txt" : type);
if(navigator.msSaveOrOpenBlob){
navigator.msSaveOrOpenBlob(blob, filename);
}else{
element.setAttribute('href', window.URL.createObjectURL(blob));
//set file title
element.setAttribute('download', filename);
//trigger download
element.style.display = 'none';
document.body.appendChild(element);
element.click();
//remove temporary link element
document.body.removeChild(element);
}
};
//downloaders
Download.prototype.downloaders = {
csv:function(columns, data, options, setFileContents){
var titles = [],
fields = [],
delimiter = options && options.delimiter ? options.delimiter : ",",
fileContents;
//get field lists
columns.forEach(function(column){
if(column.field){
titles.push('"' + String(column.title).split('"').join('""') + '"');
fields.push(column.field);
}
})
//generate header row
fileContents = [titles.join(delimiter)];
//generate each row of the table
data.forEach(function(row){
var rowData = [];
fields.forEach(function(field){
var value = typeof row[field] == "object" ? JSON.stringify(row[field]) : row[field];
//escape uotation marks
rowData.push('"' + String(value).split('"').join('""') + '"');
})
fileContents.push(rowData.join(delimiter));
});
setFileContents(fileContents.join("\n"), "text/csv");
},
json:function(columns, data, options, setFileContents){
var fileContents = JSON.stringify(data, null, '\t');
setFileContents(fileContents, "application/json");
},
xlsx:function(columns, data, options, setFileContents){
var titles = [],
fields = [],
rows = [],
workbook = { SheetNames:["Sheet1"], Sheets:{} },
worksheet, output;
//convert rows to worksheet
function rowsToSheet(){
var sheet = {};
var range = {s: {c:0, r:0}, e: {c:fields.length, r:rows.length }};
rows.forEach(function(row, i){
row.forEach(function(value, j){
var cell = {v: typeof value == "undefined" ? "" : value};
if(cell != null){
switch(typeof cell.v){
case "number":
cell.t = 'n';
break;
case "boolean":
cell.t = 'b';
break;
default:
cell.t = 's';
break;
}
sheet[XLSX.utils.encode_cell({c:j,r:i})] = cell
}
});
});
sheet['!ref'] = XLSX.utils.encode_range(range);
return sheet;
}
//convert workbook to binary array
function s2ab(s) {
var buf = new ArrayBuffer(s.length);
var view = new Uint8Array(buf);
for (var i=0; i!=s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
return buf;
}
//get field lists
columns.forEach(function(column){
if(column.field){
titles.push(column.title);
fields.push(column.field);
}
});
rows.push(fields);
//generate each row of the table
data.forEach(function(row){
var rowData = [];
fields.forEach(function(field){
rowData.push(row[field]);
})
rows.push(rowData);
});
worksheet = rowsToSheet();
workbook.Sheets["Sheet1"] = worksheet;
output = XLSX.write(workbook, {bookType:'xlsx', bookSST:true, type: 'binary'});
setFileContents(s2ab(output), "application/octet-stream");
}
};
Tabulator.registerExtension("download", Download);
|
import React from "react"
import PropTypes from "prop-types"
import { motion } from "framer-motion"
import "../styles/intro.css";
export default class IntroPage extends React.Component {
constructor(props){
super(props);
if(props.onFinish){
props.onFinish();
}
}
render(){
return(<div className="text">
<span className="firstLine">Janvier 2320
<br/>Vous découvrez le message laissé par les derniers pollueurs :</span>
<span className="quote">”Nous regrettons de ne pas avoir pris plus tôt les bonnes décisions en matière d’écologie”.</span>
<motion.h2 style={{display:"inline-block",position:"relative",width:"80%",left:"10%",textAlign:"center"}} initial={{opacity:0,y:20}} animate={{opacity:1,y:0}} transition={{type:"tween",duration:.5}}>Votre mission :
</motion.h2>
<span style={{display:"inline-block",position:"relative",width:"80%",left:"10%"}}>Reconnaître les innovations et alternatives disponibles dès 2020
afin de participer au développement d’un monde plus écologique.</span>
</div>);
}
}
IntroPage.propTypes = {
onFinish: PropTypes.func
}
|
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _createSvgIcon = _interopRequireDefault(require("./utils/createSvgIcon"));
var _jsxRuntime = require("react/jsx-runtime");
var _default = (0, _createSvgIcon.default)([/*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
d: "M11 20h2v-3.83l3-3V11H8v2.17l3 3z",
opacity: ".3"
}, "0"), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
d: "m6 14 3 3v5h6v-5l3-3V9H6v5zm2-3h8v2.17l-3 3V20h-2v-3.83l-3-3V11zm3-9h2v3h-2zM4.916 4.464l2.12 2.122L5.62 8 3.5 5.877zM18.372 8l-1.414-1.414 2.12-2.12 1.415 1.413z"
}, "1")], 'HighlightTwoTone');
exports.default = _default;
|
var express = require('express');
var router = express.Router();
// Require controller modules
var book_controller = require('../controllers/bookController');
var author_controller = require('../controllers/authorController');
var genre_controller = require('../controllers/genreController');
var book_instance_controller = require('../controllers/bookinstanceController');
/// BOOK ROUTES ///
/* GET catalog home page. */
router.get('/', book_controller.index);
/* GET request for creating a Book. NOTE This must come before routes that display Book (uses id) */
router.get('/book/create', book_controller.book_create_get);
/* POST request for creating Book. */
router.post('/book/create', book_controller.book_create_post);
/* ADD: Create book instance from book*/
router.get('/book/:id/createinstance',book_controller.book_createinstance_get);
/* ADD: Create book instance from book*/
router.post('/book/:id/createinstance',book_controller.book_createinstance_post);
/* GET request to delete Book. */
router.get('/book/:id/delete', book_controller.book_delete_get);
// POST request to delete Book
router.post('/book/:id/delete', book_controller.book_delete_post);
/* GET request to update Book. */
router.get('/book/:id/update', book_controller.book_update_get);
// POST request to update Book
router.post('/book/:id/update', book_controller.book_update_post);
/* GET request for one Book. */
router.get('/book/:id', book_controller.book_detail);
/* GET request for list of all Book items. */
router.get('/books', book_controller.book_list);
/// AUTHOR ROUTES ///
/* GET request for creating Author. NOTE This must come before route for id (i.e. display author) */
router.get('/author/create', author_controller.author_create_get);
/* POST request for creating Author. */
router.post('/author/create', author_controller.author_create_post);
/* GET request to delete Author. */
router.get('/author/:id/delete', author_controller.author_delete_get);
// POST request to delete Author
router.post('/author/:id/delete', author_controller.author_delete_post);
/* GET request to update Author. */
router.get('/author/:id/update', author_controller.author_update_get);
// POST request to update Author
router.post('/author/:id/update', author_controller.author_update_post);
/* GET request for one Author. */
router.get('/author/:id', author_controller.author_detail);
/* GET request for list of all Authors. */
router.get('/authors', author_controller.author_list);
/// GENRE ROUTES ///
/* GET request for creating a Genre. NOTE This must come before route that displays Genre (uses id) */
router.get('/genre/create', genre_controller.genre_create_get);
/* POST request for creating Genre. */
router.post('/genre/create', genre_controller.genre_create_post);
/* GET request to delete Genre. */
router.get('/genre/:id/delete', genre_controller.genre_delete_get);
// POST request to delete Genre
router.post('/genre/:id/delete', genre_controller.genre_delete_post);
/* GET request to update Genre. */
router.get('/genre/:id/update', genre_controller.genre_update_get);
// POST request to update Genre
router.post('/genre/:id/update', genre_controller.genre_update_post);
/* GET request for one Genre. */
router.get('/genre/:id', genre_controller.genre_detail);
/* GET request for list of all Genre. */
router.get('/genres', genre_controller.genre_list);
/// BOOKINSTANCE ROUTES ///
/* GET request for creating a BookInstance. NOTE This must come before route that displays BookInstance (uses id) */
router.get('/bookinstance/create', book_instance_controller.bookinstance_create_get);
/* POST request for creating BookInstance. */
router.post('/bookinstance/create', book_instance_controller.bookinstance_create_post);
/* GET request to delete BookInstance. */
router.get('/bookinstance/:id/delete', book_instance_controller.bookinstance_delete_get);
// POST request to delete BookInstance
router.post('/bookinstance/:id/delete', book_instance_controller.bookinstance_delete_post);
/* GET request to update BookInstance. */
router.get('/bookinstance/:id/update', book_instance_controller.bookinstance_update_get);
// POST request to update BookInstance
router.post('/bookinstance/:id/update', book_instance_controller.bookinstance_update_post);
/* GET request for one BookInstance. */
router.get('/bookinstance/:id', book_instance_controller.bookinstance_detail);
/* GET request for list of all BookInstance. */
router.get('/bookinstances', book_instance_controller.bookinstance_list);
module.exports = router;
|
import React, { Fragment } from "react";
import { Circle } from "react-konva";
import { getRoot, types } from "mobx-state-tree";
import WithStatesMixin from "../mixins/WithStates";
import NormalizationMixin from "../mixins/Normalization";
import RegionsMixin from "../mixins/Regions";
import Registry from "../core/Registry";
import { ImageModel } from "../tags/object/Image";
import { guidGenerator } from "../core/Helpers";
import { LabelOnKP } from "../components/ImageView/LabelOnRegion";
import { AreaMixin } from "../mixins/AreaMixin";
import { useRegionStyles } from "../hooks/useRegionColor";
import { AliveRegion } from "./AliveRegion";
import { KonvaRegionMixin } from "../mixins/KonvaRegion";
const Model = types
.model({
id: types.optional(types.identifier, guidGenerator),
pid: types.optional(types.string, guidGenerator),
type: "keypointregion",
object: types.late(() => types.reference(ImageModel)),
x: types.number,
y: types.number,
width: types.number,
coordstype: types.optional(types.enumeration(["px", "perc"]), "perc"),
negative: false,
})
.volatile(() => ({
relativeX: 0,
relativeY: 0,
hideable: true,
supportsTransform: true,
useTransformer: false,
supportsRotate: false,
supportsScale: false,
}))
.views(self => ({
get store() {
return getRoot(self);
},
get bboxCoords() {
return {
left: self.x - self.width,
top: self.y - self.width,
right: self.x + self.width,
bottom: self.y + self.width,
};
},
}))
.actions(self => ({
afterCreate() {
if (self.coordstype === "perc") {
// deserialization
self.relativeX = self.x;
self.relativeY = self.y;
self.checkSizes();
} else {
// creation
const { stageWidth: width, stageHeight: height } = self.parent;
if (width && height) {
self.relativeX = (self.x / width) * 100;
self.relativeY = (self.y / height) * 100;
}
}
},
// @todo not used
rotate(degree) {
const p = self.rotatePoint(self, degree);
self.setPosition(p.x, p.y);
},
setPosition(x, y) {
self.x = x;
self.y = y;
self.relativeX = (x / self.parent.stageWidth) * 100;
self.relativeY = (y / self.parent.stageHeight) * 100;
},
updateImageSize(wp, hp, sw, sh) {
if (self.coordstype === "px") {
self.x = (sw * self.relativeX) / 100;
self.y = (sh * self.relativeY) / 100;
}
if (self.coordstype === "perc") {
self.x = (sw * self.x) / 100;
self.y = (sh * self.y) / 100;
self.width = (sw * self.width) / 100;
self.coordstype = "px";
}
},
/**
* @example
* {
* "original_width": 1920,
* "original_height": 1280,
* "image_rotation": 0,
* "value": {
* "x": 3.1,
* "y": 8.2,
* "width": 2,
* "keypointlabels": ["Car"]
* }
* }
* @typedef {Object} KeyPointRegionResult
* @property {number} original_width width of the original image (px)
* @property {number} original_height height of the original image (px)
* @property {number} image_rotation rotation degree of the image (deg)
* @property {Object} value
* @property {number} value.x x coordinate by percentage of the image size (0-100)
* @property {number} value.y y coordinate by percentage of the image size (0-100)
* @property {number} value.width point size by percentage of the image size (0-100)
*/
/**
* @return {KeyPointRegionResult}
*/
serialize() {
const result = {
original_width: self.parent.naturalWidth,
original_height: self.parent.naturalHeight,
image_rotation: self.parent.rotation,
value: {
x: self.convertXToPerc(self.x),
y: self.convertYToPerc(self.y),
width: self.convertHDimensionToPerc(self.width),
},
};
if (self.dynamic) {
result.is_positive = !self.negative;
result.value.labels = self.labels;
}
return result;
},
}));
const KeyPointRegionModel = types.compose(
"KeyPointRegionModel",
WithStatesMixin,
RegionsMixin,
AreaMixin,
NormalizationMixin,
KonvaRegionMixin,
Model,
);
const HtxKeyPointView = ({ item }) => {
const { store } = item;
const x = item.x;
const y = item.y;
const regionStyles = useRegionStyles(item, {
includeFill: true,
defaultFillColor: "#000",
defaultStrokeColor: "#fff",
defaultFillOpacity: (item.style ?? item.tag) ? 0.6 : 1,
defaultStrokeWidth: 2,
});
const props = {
opacity: 1,
fill: regionStyles.fillColor,
stroke: regionStyles.strokeColor,
strokeWidth: Math.max(2, regionStyles.strokeWidth),
strokeScaleEnabled: false,
shadowBlur: 0,
};
const stage = item.parent.stageRef;
return (
<Fragment>
<Circle
x={x}
y={y}
radius={Math.max(item.width, 2)}
// fixes performance, but opactity+borders might look not so good
perfectDrawEnabled={false}
scaleX={1 / item.parent.zoomScale}
scaleY={1 / item.parent.zoomScale}
name={`${item.id} _transformable`}
onDragStart={e => {
if (item.parent.getSkipInteractions()) {
e.currentTarget.stopDrag(e.evt);
return;
}
}}
onDragEnd={e => {
const t = e.target;
item.setPosition(t.getAttr("x"), t.getAttr("y"));
item.notifyDrawingFinished();
}}
dragBoundFunc={item.parent.fixForZoom(pos => {
const r = item.parent.stageWidth;
const b = item.parent.stageHeight;
let { x, y } = pos;
if (x < 0) x = 0;
if (y < 0) y = 0;
if (x > r) x = r;
if (y > b) y = b;
return { x, y };
})}
onTransformEnd={e => {
const t = e.target;
item.setPosition(
t.getAttr("x"),
t.getAttr("y"),
);
t.setAttr("scaleX", 1);
t.setAttr("scaleY", 1);
}}
onMouseOver={() => {
if (store.annotationStore.selected.relationMode) {
item.setHighlight(true);
stage.container().style.cursor = "crosshair";
} else {
stage.container().style.cursor = "pointer";
}
}}
onMouseOut={() => {
stage.container().style.cursor = "default";
if (store.annotationStore.selected.relationMode) {
item.setHighlight(false);
}
}}
onClick={e => {
if (!item.annotation.editable || item.parent.getSkipInteractions()) return;
if (store.annotationStore.selected.relationMode) {
stage.container().style.cursor = "default";
}
item.setHighlight(false);
item.onClickRegion(e);
}}
{...props}
draggable={item.editable}
/>
<LabelOnKP item={item} color={regionStyles.strokeColor}/>
</Fragment>
);
};
const HtxKeyPoint = AliveRegion(HtxKeyPointView);
Registry.addTag("keypointregion", KeyPointRegionModel, HtxKeyPoint);
Registry.addRegionType(
KeyPointRegionModel,
"image",
value => "x" in value && "y" in value && "width" in value && !("height" in value),
);
export { KeyPointRegionModel, HtxKeyPoint };
|
"use strict";
$('#clear').click(clearCircuit);
$('#embed').click(insertCircuitFromInput);
(function () {
// The initialize function must be run each time a new page is loaded
Office.initialize = function (reason) {
$(document).ready(function () {
var circuit = Office.context.document.settings.get('circuit');
if (circuit) {
insertSavedCircuit(circuit);
}
else {
showInsertControls();
}
});
};
})();
function showInsertControls(){
$('#input-box').removeClass('hidden');
$('#embed').removeClass('hidden');
$('#clear').addClass('hidden');
}
// Insert circuit by accepting circuitID from text input
function insertCircuitFromInput(circuitID) {
var circuitID = $('#circuitID').val();
var src = 'https://circuitverse.org/simulator/embed/'+circuitID;
var iframe = '<iframe width="800" height="400" src="'+src+'" scrolling="no" webkitAllowFullScreen mozAllowFullScreen allowFullScreen> </iframe>';
$('#content-main').html(iframe);
Office.context.document.settings.set('circuit', circuitID);
persistChanges();
$('#input-box').addClass('hidden');
$('#embed').addClass('hidden');
$('#clear').removeClass('hidden');
}
// Insert a saved circuit
function insertSavedCircuit(circuitID){
var src = 'https://circuitverse.org/simulator/embed/'+circuitID;
var iframe = '<iframe width="800" height="365" src="'+src+'" scrolling="no" webkitAllowFullScreen mozAllowFullScreen allowFullScreen> </iframe>';
$('#content-main').html(iframe);
$('#clear').removeClass('hidden');
}
function clearCircuit() {
Office.context.document.settings.remove('circuit');
persistChanges();
showInsertControls();
$('#content-main').html(" <img id = 'background' src ='https://circuitverse.org/img/circuitverse_black.svg' >")
}
function persistChanges() {
Office.context.document.settings.saveAsync(function (asyncResult) {
if (asyncResult.status == Office.AsyncResultStatus.Failed) {
console.log('Settings save failed. Error: ' + asyncResult.error.message);
} else {
console.log('Settings saved.');
}
});
}
|
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
/*
Add altering commands here.
Return a promise to correctly handle asynchronicity.
Example:
return queryInterface.bulkInsert('People', [{
name: 'John Doe',
isBetaMember: false
}], {});
*/
// return queryInterface.bulkInsert('user', [{
// firstName: 'John',
// lastName: 'Doe',
// email: 'demo@demo.com'
// }], {});
},
down: (queryInterface, Sequelize) => {
/*
Add reverting commands here.
Return a promise to correctly handle asynchronicity.
Example:
return queryInterface.bulkDelete('People', null, {});
*/
return queryInterface.bulkDelete('user', null, {});
}
};
|
/*
Holder - 1.9 - client side image placeholders
(c) 2012-2013 Ivan Malopinsky / http://imsky.co
Provided under the Apache 2.0 License: http://www.apache.org/licenses/LICENSE-2.0
Commercial use requires attribution.
*/
var Holder=Holder||{};(function(app,win){var preempted=false,fallback=false,canvas=document.createElement('canvas');document.getElementsByClassName||(document.getElementsByClassName=function(e){var t=document,n,r,i,s=[];if(t.querySelectorAll)return t.querySelectorAll("."+e);if(t.evaluate){r=".//*[contains(concat(' ', @class, ' '), ' "+e+" ')]",n=t.evaluate(r,t,null,0,null);while(i=n.iterateNext())s.push(i)}else{n=t.getElementsByTagName("*"),r=new RegExp("(^|\\s)"+e+"(\\s|$)");for(i=0;i<n.length;i++)r.test(n[i].className)&&s.push(n[i])}return s})
window.getComputedStyle||(window.getComputedStyle=function(e,t){return this.el=e,this.getPropertyValue=function(t){var n=/(\-([a-z]){1})/g;return t=="float"&&(t="styleFloat"),n.test(t)&&(t=t.replace(n,function(){return arguments[2].toUpperCase()})),e.currentStyle[t]?e.currentStyle[t]:null},this})
function contentLoaded(n,t){var l="complete",s="readystatechange",u=!1,h=u,c=!0,i=n.document,a=i.documentElement,e=i.addEventListener?"addEventListener":"attachEvent",v=i.addEventListener?"removeEventListener":"detachEvent",f=i.addEventListener?"":"on",r=function(e){(e.type!=s||i.readyState==l)&&((e.type=="load"?n:i)[v](f+e.type,r,u),!h&&(h=!0)&&t.call(n,null))},o=function(){try{a.doScroll("left")}catch(n){setTimeout(o,50);return}r("poll")};if(i.readyState==l)t.call(n,"lazy");else{if(i.createEventObject&&a.doScroll){try{c=!n.frameElement}catch(y){}c&&o()}i[e](f+"DOMContentLoaded",r,u),i[e](f+s,r,u),n[e](f+"load",r,u)}};function selector(a){a=a.match(/^(\W)?(.*)/);var b=document["getElement"+(a[1]?a[1]=="#"?"ById":"sByClassName":"sByTagName")](a[2]);var ret=[];b!=null&&(b.length?ret=b:b.length==0?ret=b:ret=[b]);return ret;}
function extend(a,b){var c={};for(var d in a)c[d]=a[d];for(var e in b)c[e]=b[e];return c}
if(!Object.prototype.hasOwnProperty)
Object.prototype.hasOwnProperty=function(prop){var proto=this.__proto__||this.constructor.prototype;return(prop in this)&&(!(prop in proto)||proto[prop]!==this[prop]);}
function text_size(width,height,template){var dimension_arr=[height,width].sort();var maxFactor=Math.round(dimension_arr[1]/16),minFactor=Math.round(dimension_arr[0]/16);var text_height=Math.max(template.size,maxFactor);return{height:text_height}}
function draw(ctx,dimensions,template,ratio){var ts=text_size(dimensions.width,dimensions.height,template);var text_height=ts.height;var width=dimensions.width*ratio,height=dimensions.height*ratio;var font=template.font?template.font:"sans-serif";canvas.width=width;canvas.height=height;ctx.textAlign="center";ctx.textBaseline="middle";ctx.fillStyle=template.background;ctx.fillRect(0,0,width,height);ctx.fillStyle=template.foreground;ctx.font="bold "+text_height+"px "+font;var text=template.text?template.text:(dimensions.width+"x"+dimensions.height);if(ctx.measureText(text).width/width>1){text_height=template.size/(ctx.measureText(text).width/width);}
ctx.font="bold "+(text_height*ratio)+"px "+font;ctx.fillText(text,(width/2),(height/2),width);return canvas.toDataURL("image/png");}
function render(mode,el,holder,src){var dimensions=holder.dimensions,theme=holder.theme,text=holder.text?decodeURIComponent(holder.text):holder.text;var dimensions_caption=dimensions.width+"x"+dimensions.height;theme=(text?extend(theme,{text:text}):theme);theme=(holder.font?extend(theme,{font:holder.font}):theme);var ratio=1;if(window.devicePixelRatio&&window.devicePixelRatio>1){ratio=window.devicePixelRatio;}
if(mode=="image"){el.setAttribute("data-src",src);el.setAttribute("alt",text?text:theme.text?theme.text+" ["+dimensions_caption+"]":dimensions_caption);if(fallback||!holder.auto){el.style.width=dimensions.width+"px";el.style.height=dimensions.height+"px";}
if(fallback){el.style.backgroundColor=theme.background;}
else{el.setAttribute("src",draw(ctx,dimensions,theme,ratio));}}else{if(!fallback){el.style.backgroundImage="url("+draw(ctx,dimensions,theme,ratio)+")";el.style.backgroundSize=dimensions.width+"px "+dimensions.height+"px";}}};function fluid(el,holder,src){var dimensions=holder.dimensions,theme=holder.theme,text=holder.text;var dimensions_caption=dimensions.width+"x"+dimensions.height;theme=(text?extend(theme,{text:text}):theme);var fluid=document.createElement("div");fluid.style.backgroundColor=theme.background;fluid.style.color=theme.foreground;fluid.className=el.className+" holderjs-fluid";fluid.style.width=holder.dimensions.width+(holder.dimensions.width.indexOf("%")>0?"":"px");fluid.style.height=holder.dimensions.height+(holder.dimensions.height.indexOf("%")>0?"":"px");fluid.id=el.id;el.style.width=0;el.style.height=0;if(theme.text){fluid.appendChild(document.createTextNode(theme.text))}else{fluid.appendChild(document.createTextNode(dimensions_caption))
fluid_images.push(fluid);setTimeout(fluid_update,0);}
el.parentNode.insertBefore(fluid,el.nextSibling)
if(window.jQuery){jQuery(function($){$(el).on("load",function(){el.style.width=fluid.style.width;el.style.height=fluid.style.height;$(el).show();$(fluid).remove();});})}}
function fluid_update(){for(i in fluid_images){if(!fluid_images.hasOwnProperty(i))continue;var el=fluid_images[i],label=el.firstChild;el.style.lineHeight=el.offsetHeight+"px";label.data=el.offsetWidth+"x"+el.offsetHeight;}}
function parse_flags(flags,options){var ret={theme:settings.themes.gray},render=false;for(sl=flags.length,j=0;j<sl;j++){var flag=flags[j];if(app.flags.dimensions.match(flag)){render=true;ret.dimensions=app.flags.dimensions.output(flag);}else if(app.flags.fluid.match(flag)){render=true;ret.dimensions=app.flags.fluid.output(flag);ret.fluid=true;}else if(app.flags.colors.match(flag)){ret.theme=app.flags.colors.output(flag);}else if(options.themes[flag]){ret.theme=options.themes[flag];}else if(app.flags.text.match(flag)){ret.text=app.flags.text.output(flag);}else if(app.flags.font.match(flag)){ret.font=app.flags.font.output(flag);}
else if(app.flags.auto.match(flag)){ret.auto=true;}}
return render?ret:false;};if(!canvas.getContext){fallback=true;}else{if(canvas.toDataURL("image/png").indexOf("data:image/png")<0){fallback=true;}else{var ctx=canvas.getContext("2d");}}
var fluid_images=[];var settings={domain:"holder.js",images:"img",bgnodes:".holderjs",themes:{"gray":{background:"#eee",foreground:"#aaa",size:12},"social":{background:"#3a5a97",foreground:"#fff",size:12},"industrial":{background:"#434A52",foreground:"#C2F200",size:12}},stylesheet:".holderjs-fluid {font-size:16px;font-weight:bold;text-align:center;font-family:sans-serif;margin:0}"};app.flags={dimensions:{regex:/^(\d+)x(\d+)$/,output:function(val){var exec=this.regex.exec(val);return{width:+exec[1],height:+exec[2]}}},fluid:{regex:/^([0-9%]+)x([0-9%]+)$/,output:function(val){var exec=this.regex.exec(val);return{width:exec[1],height:exec[2]}}},colors:{regex:/#([0-9a-f]{3,})\:#([0-9a-f]{3,})/i,output:function(val){var exec=this.regex.exec(val);return{size:settings.themes.gray.size,foreground:"#"+exec[2],background:"#"+exec[1]}}},text:{regex:/text\:(.*)/,output:function(val){return this.regex.exec(val)[1];}},font:{regex:/font\:(.*)/,output:function(val){return this.regex.exec(val)[1];}},auto:{regex:/^auto$/}}
for(var flag in app.flags){if(!app.flags.hasOwnProperty(flag))continue;app.flags[flag].match=function(val){return val.match(this.regex)}}
app.add_theme=function(name,theme){name!=null&&theme!=null&&(settings.themes[name]=theme);return app;};app.add_image=function(src,el){var node=selector(el);if(node.length){for(var i=0,l=node.length;i<l;i++){var img=document.createElement("img")
img.setAttribute("data-src",src);node[i].appendChild(img);}}
return app;};app.run=function(o){var options=extend(settings,o),images=[];if(options.images instanceof window.NodeList){imageNodes=options.images;}
else if(options.images instanceof window.Node){imageNodes=[options.images];}
else{imageNodes=selector(options.images);}
if(options.elements instanceof window.NodeList){bgnodes=options.bgnodes;}
else if(options.bgnodes instanceof window.Node){bgnodes=[options.bgnodes];}
else{bgnodes=selector(options.bgnodes);}
preempted=true;for(i=0,l=imageNodes.length;i<l;i++)images.push(imageNodes[i]);var holdercss=document.getElementById("holderjs-style");if(!holdercss){holdercss=document.createElement("style");holdercss.setAttribute("id","holderjs-style");holdercss.type="text/css";document.getElementsByTagName("head")[0].appendChild(holdercss);}
if(holdercss.styleSheet){holdercss.styleSheet+=options.stylesheet;}
else{holdercss.textContent+=options.stylesheet;}
var cssregex=new RegExp(options.domain+"\/(.*?)\"?\\)");for(var l=bgnodes.length,i=0;i<l;i++){var src=window.getComputedStyle(bgnodes[i],null).getPropertyValue("background-image");var flags=src.match(cssregex);if(flags){var holder=parse_flags(flags[1].split("/"),options);if(holder){render("background",bgnodes[i],holder,src);}}}
for(var l=images.length,i=0;i<l;i++){var src=images[i].getAttribute("src")||images[i].getAttribute("data-src");if(src!=null&&src.indexOf(options.domain)>=0){var holder=parse_flags(src.substr(src.lastIndexOf(options.domain)+options.domain.length+1).split("/"),options);if(holder){if(holder.fluid){fluid(images[i],holder,src);}else{render("image",images[i],holder,src);}}}}
return app;};contentLoaded(win,function(){if(window.addEventListener){window.addEventListener("resize",fluid_update,false);window.addEventListener("orientationchange",fluid_update,false);}else{window.attachEvent("onresize",fluid_update)}
preempted||app.run();});if(typeof define==="function"&&define.amd){define("Holder",[],function(){return app;});}})(Holder,window);
|
const { Bluetooth, Printer } = require('..');
(async () => {
try {
const availablePrinters = await Bluetooth.findPrinters();
// Uncomment if you want to use a specific printer instead of the first bt device that responds:
// const preferredPrinterName = 'MHT-P5801';
// const btPrinter = availablePrinters.filter(p => p && p.name === preferredPrinterName)[0];
const btPrinter = availablePrinters[0];
console.log('Connect to ' + btPrinter.name);
const device = await Bluetooth.getDevice(btPrinter.address, btPrinter.channel);
const printer = await Printer.create(device);
await printer.text('hello');
await printer.cut();
await printer.close();
console.log('print job done');
} catch(error) {
console.log('error', error);
}
})();
|
$(document).ready(function(){
var cityName;
var getSearchCity = JSON.parse(localStorage.getItem("citySearches"));
if (getSearchCity) {
getSearchCity = getSearchCity.split(";");
cityName = getSearchCity[0];
getWeatherData(cityName);
} else {
$(".five-day-heading").hide();
$(".five-day-detail").hide();
}
displayCities();
$("#searchBtn").on("click", function(event){
event.preventDefault();
$(".five-day-heading").show();
$(".five-day-detail").show();
cityName = $("#city-search").val().trim();
getWeatherData(cityName);
var getSearchCities = [];
getSearchCities = JSON.parse(localStorage.getItem("citySearches"));
if (getSearchCities && !getSearchCities.includes(cityName)) {
getSearchCities = `${cityName};${getSearchCities}`;
} else {
getSearchCities = cityName;
}
localStorage.setItem("citySearches", JSON.stringify(getSearchCities));
$("#search-buttons").empty();
displayCities();
});
function displayCities() {
var searchButtons = JSON.parse(localStorage.getItem("citySearches"));
if (searchButtons) {
searchButtons = searchButtons.split(";");
}
$.each(searchButtons, function(i) {
var newButton = $("<button>").attr("type", "button").attr("class", "btn btn-outline-secondary btn-block city-button").attr("id", searchButtons[i]).html(searchButtons[i]);
newButton.appendTo("#search-buttons");
});
$(".city-button").on("click", function(event){
event.preventDefault();
console.log(this.id);
getWeatherData(this.id);
$("#city-search").val(this.id);
});
}
function getWeatherData(searchFor) {
if (!searchFor) {
searchFor = "Philadelphia, PA";
}
//set variables, build url for first API call
var apiKey = "52618b568e2d61b0b27171c59411a439";
var queryURLGetLatLong = `https://api.openweathermap.org/data/2.5/weather?q=${searchFor},us&appid=${apiKey}`;
$.ajax({
url: queryURLGetLatLong,
method: "GET"
})
.then(function(responseLatLong) {
//set variables from response
var getLat = responseLatLong.coord.lat;
var getLong = responseLatLong.coord.lon;
var getCityName = responseLatLong.name;
//use variables from response to build URL
var queryURL = `https://api.openweathermap.org/data/2.5/onecall?lat=${getLat}&lon=${getLong}&exclude=minutely,hourly&appid=${apiKey}&units=imperial`
$.ajax({
url: queryURL,
method: "GET"
})
.then(function(response) {
//set variables from response
var getCurrentDate = (moment(response.current.dt*1000).format("dddd MM.DD.YYYY"));
var getCurrentTemp = response.current.temp.toFixed(1);
var getHumidity = Math.round(response.current.humidity);
var getWindSpeed = response.current.wind_speed.toFixed(1);
var getUVIndex = response.current.uvi.toFixed(2);
var getCurrentWeather = response.current.weather[0].main;
var getCurrentWeatherIcon = `http://openweathermap.org/img/wn/${response.current.weather[0].icon}.png`;
//set and create current weather elements in HTML using data from response
$("#city-date").html(`${getCityName} (${getCurrentDate})`)
var currentWeatherIcon = $("<img>").attr("src", getCurrentWeatherIcon);
currentWeatherIcon.appendTo("#city-date");
$("#current-weather").html(`${getCurrentWeather}`);
$("#current-temp").html(`Temperature: <strong>${getCurrentTemp} °F</strong>`);
$("#current-humidity").html(`Humidity: <strong>${getHumidity}%</strong>`);
$("#wind-speed").html(`Wind Speed: <strong>${getWindSpeed} MPH</strong>`);
$("#uv-index-label").html(`UV Index: `);
//highlight UV Index according to chart found online
if (getUVIndex < 3) {
$("#uv-index-number").html(`<strong>${getUVIndex}</strong>`).attr("class", "uvIndexLow12").appendTo("#uv-index");
} else
if (getUVIndex >= 3 && getUVIndex < 6 ) {
$("#uv-index-number").html(`<strong>${getUVIndex}</strong>`).attr("class", "uvIndexModerate35").appendTo("#uv-index");
} else
if (getUVIndex >= 6 && getUVIndex < 8 ) {
$("#uv-index-number").html(`<strong>${getUVIndex}</strong>`).attr("class", "uvIndexHigh67").appendTo("#uv-index");
} else
if (getUVIndex >= 8 && getUVIndex < 11 ) {
$("#uv-index-number").html(`<strong>${getUVIndex}</strong>`).attr("class", "uvIndexVeryHigh810");
} else
if (getUVIndex >= 11) {
$("#uv-index-number").html(`<strong>${getUVIndex}</strong>`).attr("class", "uvIndexExtreme11").appendTo("#uv-index");
}
//set shortcut variable for five day data
var fiveDay = response.daily;
//loop through response to get next 5 days' data
for (var i = 1; i < 6; i++) {
//set variables for each day
var fiveDayDate = moment(fiveDay[i].dt*1000).format("ddd MM.DD");
var fiveDayTemp = fiveDay[i].temp.day.toFixed(2);
var fiveDayTempLow = fiveDay[i].temp.min.toFixed(2);
var fiveDayTempHigh = fiveDay[i].temp.max.toFixed(2);
var fiveDayTempFeelsLike = fiveDay[i].feels_like.day.toFixed(2);
var fiveDayHumidity = Math.round(fiveDay[i].humidity);
var fiveDayWeather = fiveDay[i].weather[0].main;
var fiveDayWeatherIcon = `http://openweathermap.org/img/wn/${fiveDay[i].weather[0].icon}.png`;
//set html elements using 5 day data
//ids in HTML have been set accordingly to use i in loop
$(`#title${i}`).html(fiveDayDate);
var dailyWeatherIcon = $("<img>").attr("src", fiveDayWeatherIcon);
dailyWeatherIcon.appendTo(`#title${i}`);
$(`#weather${i}`).html(`<strong>${fiveDayWeather}</strong>`);
$(`#temp${i}`).html(`Temp: <strong>${fiveDayTemp} °F</strong>`);
$(`#temp-feels-like${i}`).html(`Feels Like: <strong>${fiveDayTempFeelsLike} °F</strong>`);
$(`#temp-max${i}`).html(`High: <strong>${fiveDayTempHigh} °F</strong>`);
$(`#temp-min${i}`).html(`Low: <strong>${fiveDayTempLow} °F</strong>`);
$(`#humidity${i}`).html(`Humidity: <strong>${fiveDayHumidity}%</strong>`);
} //end loop for daily weather
}); //end then returning response
}); //end then returning responseLatLong
}
})
|
import { LightningElement } from "lwc";
export default class TestCss extends LightningElement {
}
|
import path from 'path';
import cosmiconfig from 'cosmiconfig';
export function loadOptionsFromConfigDir(configDirectory) {
const searchPath = configDirectory || './';
const cosmic = cosmiconfig('graphql-schema-linter', {
cache: false,
}).searchSync(searchPath);
if (cosmic) {
let schemaPaths = [];
let customRulePaths = [];
// If schemaPaths come from cosmic, we resolve the given paths relative to the searchPath.
if (cosmic.config.schemaPaths) {
schemaPaths = cosmic.config.schemaPaths.map(schemaPath =>
path.resolve(searchPath, schemaPath)
);
}
// If customRulePaths come from cosmic, we resolve the given paths relative to the searchPath.
if (cosmic.config.customRulePaths) {
customRulePaths = cosmic.config.customRulePaths.map(schemaPath =>
path.resolve(searchPath, schemaPath)
);
}
return {
rules: cosmic.config.rules,
customRulePaths: customRulePaths || [],
schemaPaths: schemaPaths,
};
} else {
return {};
}
}
|
/**
* Created by liwei on 2016/12/26.
*/
$(function(){
$(".class-group-sub a").hover(function() {
var $parent = $(this).parents(".class-group-con");
$parent.find(".class-group-sub-group").removeClass("on");
var bh = $(this).attr("data-bh");
$parent.find(".class-group-sub-group[data-bh='" + bh + "']").addClass("on");
$parent.find(".class-group-sub li a").removeClass("on");
$(this).addClass("on");
}, function() {
});
});
|
module.exports = {
user: {
subscribe: (parent, args, { pubsub }) => pubsub.asyncIterator('user createad')
}
};
|
var path = require('path');
module.exports = function(app){
app.get('/notes', function(req, res){
res.sendFile(path.join(__dirname, "../public/notes.html"));
});
app.get('*', function(req, res){
res.sendFile(path.join(__dirname, "../public/index.html"));
});
};
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'about', 'hu', {
copy: 'Copyright © $1. Minden jog fenntartva.',
dlgTitle: 'CKEditor névjegy',
help: 'Itt találsz segítséget: $1',
moreInfo: 'Licenszelési információkért kérjük látogassa meg weboldalunkat:',
title: 'CKEditor névjegy',
userGuide: 'CKEditor Felhasználói útmutató'
});
|
/******/ (() => { // webpackBootstrap
/******/ "use strict";
var __webpack_exports__ = {};
/*!*****************************************************************************!*\
!*** ../demo1/src/js/pages/crud/datatables/search-options/column-search.js ***!
\*****************************************************************************/
var KTDatatablesSearchOptionsColumnSearch = function() {
$.fn.dataTable.Api.register('column().title()', function() {
return $(this.header()).text().trim();
});
var initTable1 = function() {
// begin first table
var table = $('#kt_datatable').DataTable({
responsive: true,
// Pagination settings
dom: `<'row'<'col-sm-12'tr>>
<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7 dataTables_pager'lp>>`,
// read more: https://datatables.net/examples/basic_init/dom.html
lengthMenu: [5, 10, 25, 50],
pageLength: 10,
language: {
'lengthMenu': 'Display _MENU_',
},
searchDelay: 500,
processing: true,
serverSide: true,
ajax: {
url: HOST_URL + '/api/datatables/demos/server.php',
type: 'POST',
data: {
// parameters for custom backend script demo
columnsDef: [
'RecordID', 'OrderID', 'Country', 'ShipCity', 'CompanyAgent',
'ShipDate', 'Status', 'Type', 'Actions',
],
},
},
columns: [{
data: 'RecordID'
},
{
data: 'OrderID'
},
{
data: 'Country'
},
{
data: 'ShipCity'
},
{
data: 'CompanyAgent'
},
{
data: 'ShipDate'
},
{
data: 'Status'
},
{
data: 'Type'
},
{
data: 'Actions',
responsivePriority: -1
},
],
initComplete: function() {
var thisTable = this;
var rowFilter = $('<tr class="filter"></tr>').appendTo($(table.table().header()));
this.api().columns().every(function() {
var column = this;
var input;
switch (column.title()) {
case 'Record ID':
case 'Order ID':
case 'Ship City':
case 'Company Agent':
input = $(`<input type="text" class="form-control form-control-sm form-filter datatable-input" data-col-index="` + column.index() + `"/>`);
break;
case 'Country':
input = $(`<select class="form-control form-control-sm form-filter datatable-input" title="Select" data-col-index="` + column.index() + `">
<option value="">Select</option></select>`);
column.data().unique().sort().each(function(d, j) {
$(input).append('<option value="' + d + '">' + d + '</option>');
});
break;
case 'Status':
var status = {
1: {
'title': 'Pending',
'class': 'label-light-primary'
},
2: {
'title': 'Delivered',
'class': ' label-light-danger'
},
3: {
'title': 'Canceled',
'class': ' label-light-primary'
},
4: {
'title': 'Success',
'class': ' label-light-success'
},
5: {
'title': 'Info',
'class': ' label-light-info'
},
6: {
'title': 'Danger',
'class': ' label-light-danger'
},
7: {
'title': 'Warning',
'class': ' label-light-warning'
},
};
input = $(`<select class="form-control form-control-sm form-filter datatable-input" title="Select" data-col-index="` + column.index() + `">
<option value="">Select</option></select>`);
column.data().unique().sort().each(function(d, j) {
$(input).append('<option value="' + d + '">' + status[d].title + '</option>');
});
break;
case 'Type':
var status = {
1: {
'title': 'Online',
'state': 'danger'
},
2: {
'title': 'Retail',
'state': 'primary'
},
3: {
'title': 'Direct',
'state': 'success'
},
};
input = $(`<select class="form-control form-control-sm form-filter datatable-input" title="Select" data-col-index="` + column.index() + `">
<option value="">Select</option></select>`);
column.data().unique().sort().each(function(d, j) {
$(input).append('<option value="' + d + '">' + status[d].title + '</option>');
});
break;
case 'Ship Date':
input = $(`
<div class="input-group date">
<input type="text" class="form-control form-control-sm datatable-input" readonly placeholder="From" id="kt_datepicker_1"
data-col-index="` + column.index() + `"/>
<div class="input-group-append">
<span class="input-group-text"><i class="la la-calendar-o glyphicon-th"></i></span>
</div>
</div>
<div class="input-group date d-flex align-content-center">
<input type="text" class="form-control form-control-sm datatable-input" readonly placeholder="To" id="kt_datepicker_2"
data-col-index="` + column.index() + `"/>
<div class="input-group-append">
<span class="input-group-text"><i class="la la-calendar-o glyphicon-th"></i></span>
</div>
</div>`);
break;
case 'Actions':
var search = $(`
<button class="btn btn-primary kt-btn btn-sm kt-btn--icon d-block">
<span>
<i class="la la-search"></i>
<span>Search</span>
</span>
</button>`);
var reset = $(`
<button class="btn btn-secondary kt-btn btn-sm kt-btn--icon">
<span>
<i class="la la-close"></i>
<span>Reset</span>
</span>
</button>`);
$('<th>').append(search).append(reset).appendTo(rowFilter);
$(search).on('click', function(e) {
e.preventDefault();
var params = {};
$(rowFilter).find('.datatable-input').each(function() {
var i = $(this).data('col-index');
if (params[i]) {
params[i] += '|' + $(this).val();
} else {
params[i] = $(this).val();
}
});
$.each(params, function(i, val) {
// apply search params to datatable
table.column(i).search(val ? val : '', false, false);
});
table.table().draw();
});
$(reset).on('click', function(e) {
e.preventDefault();
$(rowFilter).find('.datatable-input').each(function(i) {
$(this).val('');
table.column($(this).data('col-index')).search('', false, false);
});
table.table().draw();
});
break;
}
if (column.title() !== 'Actions') {
$(input).appendTo($('<th>').appendTo(rowFilter));
}
});
// hide search column for responsive table
var hideSearchColumnResponsive = function() {
thisTable.api().columns().every(function() {
var column = this
if (column.responsiveHidden()) {
$(rowFilter).find('th').eq(column.index()).show();
} else {
$(rowFilter).find('th').eq(column.index()).hide();
}
})
};
// init on datatable load
hideSearchColumnResponsive();
// recheck on window resize
window.onresize = hideSearchColumnResponsive;
$('#kt_datepicker_1,#kt_datepicker_2').datepicker();
},
columnDefs: [{
targets: -1,
title: 'Actions',
orderable: false,
render: function(data, type, full, meta) {
return '\
<div class="dropdown dropdown-inline">\
<a href="javascript:;" class="btn btn-sm btn-clean btn-icon" data-toggle="dropdown">\
<i class="la la-cog"></i>\
</a>\
<div class="dropdown-menu dropdown-menu-sm dropdown-menu-right">\
<ul class="nav nav-hoverable flex-column">\
<li class="nav-item"><a class="nav-link" href="#"><i class="nav-icon la la-edit"></i><span class="nav-text">Edit Details</span></a></li>\
<li class="nav-item"><a class="nav-link" href="#"><i class="nav-icon la la-leaf"></i><span class="nav-text">Update Status</span></a></li>\
<li class="nav-item"><a class="nav-link" href="#"><i class="nav-icon la la-print"></i><span class="nav-text">Print</span></a></li>\
</ul>\
</div>\
</div>\
<a href="javascript:;" class="btn btn-sm btn-clean btn-icon" title="Edit details">\
<i class="la la-edit"></i>\
</a>\
<a href="javascript:;" class="btn btn-sm btn-clean btn-icon" title="Delete">\
<i class="la la-trash"></i>\
</a>\
';
},
},
{
targets: 5,
width: '150px',
},
{
targets: 6,
width: '100px',
render: function(data, type, full, meta) {
var status = {
1: {
'title': 'Pending',
'class': 'label-light-primary'
},
2: {
'title': 'Delivered',
'class': ' label-light-danger'
},
3: {
'title': 'Canceled',
'class': ' label-light-primary'
},
4: {
'title': 'Success',
'class': ' label-light-success'
},
5: {
'title': 'Info',
'class': ' label-light-info'
},
6: {
'title': 'Danger',
'class': ' label-light-danger'
},
7: {
'title': 'Warning',
'class': ' label-light-warning'
},
};
if (typeof status[data] === 'undefined') {
return data;
}
return '<span class="label label-lg font-weight-bold' + status[data].class + ' label-inline">' + status[data].title + '</span>';
},
},
{
targets: 7,
width: '100px',
render: function(data, type, full, meta) {
var status = {
1: {
'title': 'Online',
'state': 'danger'
},
2: {
'title': 'Retail',
'state': 'primary'
},
3: {
'title': 'Direct',
'state': 'success'
},
};
if (typeof status[data] === 'undefined') {
return data;
}
return '<span class="label label-' + status[data].state + ' label-dot mr-2"></span>' +
'<span class="font-weight-bold text-' + status[data].state + '">' + status[data].title + '</span>';
},
},
],
});
};
return {
//main function to initiate the module
init: function() {
initTable1();
},
};
}();
jQuery(document).ready(function() {
KTDatatablesSearchOptionsColumnSearch.init();
});
/******/ })()
;
//# sourceMappingURL=column-search.js.map
|
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
const class_validator_1 = require("class-validator");
class CreateApiClientDto {
}
__decorate([
class_validator_1.IsNumber(),
__metadata("design:type", Number)
], CreateApiClientDto.prototype, "value", void 0);
__decorate([
class_validator_1.IsString(),
__metadata("design:type", String)
], CreateApiClientDto.prototype, "text_value", void 0);
__decorate([
class_validator_1.IsString(),
__metadata("design:type", String)
], CreateApiClientDto.prototype, "name", void 0);
exports.CreateApiClientDto = CreateApiClientDto;
//# sourceMappingURL=create-api-client.dto.js.map
|
import React from 'react';
import Article from './Article';
const ArticleList = (props) => {
return (
<div>
{Object.values(props.articles).map(article =>
<Article
key={article.id}
article={article}
/>
)}
</div>
);
};
export default ArticleList;
|
console.log('load _drum_57_25_FluidR3_GM_sf2_file');
var _drum_57_25_FluidR3_GM_sf2_file={
zones:[
{
midi:128
,loopStart:0
,loopEnd:0
,keyRangeLow:57
,keyRangeHigh:57
,sampleRate:44100
,coarseTune:0
,fineTune:0
,originalPitch:5700
,file:'SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU3LjcyLjEwMQAAAAAAAAAAAAAA//tAwAAAAAAAAAAAAAAAAAAAAAAAWGluZwAAAA8AAADcAAF1dQAECAsOEhUXGRwfIiQnKSwuMTM1ODs9P0FFR0pMT1JUV1lbX2FjZWdrbXBzdnl8f4GEh4qMj5GVl5mcnqGkpqirrrCztbe7vb/Bw8fJy83P0tXX2dve4OPl5+rs7vHz9vj6/P8AAAAATGF2YzU3Ljk2AAAAAAAAAAAAAAAAJAY+AAAAAAABdXU2tdgKAAAAAAD/+8DEAAAHQANftAAAA6yyrb8zgADSONqSIgApKiAMLB8IAgsH8Hwfh9WXB8/6wffUGIISgIAMH35/lz/+UBDP4fLn/6cvD//E4f4Pv6wfeWlgdgIkQ0ZEbLTTQJSccoBGDLjjZYWCGFvCxwqwe0wcAFAxgFRkyByIULAv+uufVM3NuCrZ+SPipxA0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VVTEFNRTMuOTkuNVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVf/7UMT0Aw9aBR3ggGcpMrSizACPLFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVX/+xDE1gPAAAH+AAAAIAAANIAAAARVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVQ=='
,anchor:0.04931973
//'Crsh 2(L)
}
]
};
|
load("8b38e12cab5de21ec5393724c0d9b7dd.js");
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
var y = -0;
/**bp:locals()**/
WScript.Echo('PASS');
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.