How to use the cesium.defaultValue function in cesium

To help you get started, we’ve selected a few cesium examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AnalyticalGraphicsInc / gltf-pipeline / lib / addToArray.js View on Github external
'use strict';
const Cesium = require('cesium');

const defaultValue = Cesium.defaultValue;

module.exports = addToArray;

/**
 * Adds an element to an array and returns the element's index.
 *
 * @param {Array} array The array to add to.
 * @param {Object} element The element to add.
 * @param {Boolean} [checkDuplicates=false] When <code>true</code>, if a duplicate element is found its index is returned and <code>element</code> is not added to the array.
 *
 * @private
 */
function addToArray(array, element, checkDuplicates) {
    checkDuplicates = defaultValue(checkDuplicates, false);
    if (checkDuplicates) {
        const index = array.indexOf(element);
github AnalyticalGraphicsInc / gltf-pipeline / lib / readGltf.js View on Github external
'use strict';
var Cesium = require('cesium');
var fsExtra = require('fs-extra');
var path = require('path');
var Promise = require('bluebird');

var defaultValue = Cesium.defaultValue;
var defined = Cesium.defined;
var DeveloperError = Cesium.DeveloperError;

var parseBinaryGltf = require('./parseBinaryGltf');
var addPipelineExtras = require('./addPipelineExtras');
var loadGltfUris = require('./loadGltfUris');

module.exports = readGltf;

/**
 * Reads a glTF asset from the disk.
 * @param {String} gltfPath The file path for the glTF asset.
 * @param {Object} [options] Object with the following properties.
 * @param {String} [options.basePath] The base path to use for resolving external references. Defaults to the directory containing the glTF.
 * @returns {Object} A javascript object containing a glTF hierarchy.
 */
github AnalyticalGraphicsInc / gltf-pipeline / lib / mergeBuffers.js View on Github external
'use strict';
const BUFFER_MAX_BYTE_LENGTH = require('buffer').constants.MAX_LENGTH;
const Cesium = require('cesium');
const ForEach = require('./ForEach');

const defaultValue = Cesium.defaultValue;
const defined = Cesium.defined;

module.exports = mergeBuffers;

/**
 * Merge all buffers. Buffers with the same extras._pipeline.mergedBufferName will be merged together.
 *
 * @param {Object} gltf A javascript object containing a glTF asset.
 * @param {String} [defaultName] The default name of the buffer data files.
 * @returns {Object} The glTF asset with its buffers merged.
 *
 * @private
 */
function mergeBuffers(gltf, defaultName) {
    let baseBufferName = defaultName;
    ForEach.buffer(gltf, function(buffer) {
github a348019017 / 3d_tiles_tools / lib / quadtree / TestQuadTree.js View on Github external
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//测试四叉树算法
//不加路径即是从npm中查找
const shapefile = require("shapefile");
const quadtree_1 = require("./quadtree");
const envelop3D_1 = require("./envelop3D");
const loadObj = require("../../lib/loadObj");
const Cesium = require("cesium");
const objData_1 = require("../builder/objData");
const obj2gltf = require("../../lib/obj2gltf");
const gltfHelper_1 = require("../gltfEx/gltfHelper");
var defaultValue = Cesium.defaultValue;
var defined = Cesium.defined;
var DeveloperError = Cesium.DeveloperError;
//常见编码名称utf-8, iso-8859-2, koi8, cp1261, gbk
//一般使用gbk或者utf8去解决shp文件的中文乱码问题,问题再看。
function Test() {
    let shpPath = "C:\\Users\\1\\Desktop\\shp\\test_cy_zd.shp";
    let dbfPath = "C:\\Users\\1\\Desktop\\shp\\test_cy_zd.dbf";
    let option = { encoding: "gbk", highWaterMark: 65536 };
    shapefile.read(shpPath, dbfPath, option)
        .then(source => {
        let tree;
        //没有bbox将无法创建
        if (source.bbox != undefined) {
            tree = new quadtree_1.Quadtree(new envelop3D_1.Envelope3D(source.bbox[0], source.bbox[2], source.bbox[1], source.bbox[3], 0, 0), { maxLevel: 4, maxShapesCount: 20 });
        }
        else {
github AnalyticalGraphicsInc / gltf-pipeline / lib / compressIntegerAccessors.js View on Github external
'use strict';
var Cesium = require('cesium');
var Promise = require('bluebird');

var WebGLConstants = Cesium.WebGLConstants;
var defined = Cesium.defined;
var defaultValue = Cesium.defaultValue;

var AccessorReader = require('./AccessorReader');
var changeAccessorComponentType = require('./changeAccessorComponentType');
var findAccessorMinMax = require('./findAccessorMinMax');
var getAccessorsForSemantic = require('./getAccessorsForSemantic');
var uninterLeaveAndPackBuffers = require('./uninterleaveAndPackBuffers');

module.exports = compressIntegerAccessors;

var signedComponentTypes = [
    {
        componentType : WebGLConstants.BYTE,
        min : -128,
        max : 127
    },
    {
github AnalyticalGraphicsInc / gltf-pipeline / lib / NodeHelpers.js View on Github external
'use strict';
var Cesium = require('cesium');
var defined = Cesium.defined;
var defaultValue = Cesium.defaultValue;
var Matrix4 = Cesium.Matrix4;
var Cartesian3 = Cesium.Cartesian3;
var Quaternion = Cesium.Quaternion;

module.exports = NodeHelpers;

/**
 * A set of helper function for working with glTF nodes.
 * Should be called after convertDagToTree
 * @constructor
 *
 * @private
 */
function NodeHelpers() {}

var cartesian3Scratch1 = new Cartesian3();
github AnalyticalGraphicsInc / gltf-pipeline / lib / Pipeline.js View on Github external
var optimizeForVertexCache = require('./optimizeForVertexCache');
var processModelMaterialsCommon = require('./processModelMaterialsCommon');
var processPbrMetallicRoughness = require('./processPbrMetallicRoughness');
var readGltf = require('./readGltf');
var removeDuplicatePrimitives = require('./removeDuplicatePrimitives');
var removeNormals = require('./removeNormals');
var removePipelineExtras = require('./removePipelineExtras');
var removeUnusedVertices = require('./removeUnusedVertices');
var quantizeAttributes = require('./quantizeAttributes');
var updateVersion = require('./updateVersion');
var uninterleaveAndPackBuffers = require('./uninterleaveAndPackBuffers');
var writeGltf = require('./writeGltf');
var writeBinaryGltf = require('./writeBinaryGltf');
var writeSource = require('./writeSource');

var defaultValue = Cesium.defaultValue;
var defined = Cesium.defined;

module.exports = Pipeline;

/**
 * Main optimization pipeline.
 * @constructor
 */
function Pipeline() {}

/**
 * Add pipeline extras and load uris, then process the glTF asset.
 * Options are passed to loadGltfUris and processJSONWithExtras.
 *
 * @param {Object} gltf A javascript object containing a glTF asset.
 * @param {Object} [options] Options to apply to stages during optimization.
github AnalyticalGraphicsInc / gltf-pipeline / lib / addCesiumRTC.js View on Github external
'use strict';
var Cesium = require('cesium');
var Cartesian3 = Cesium.Cartesian3;
var DeveloperError = Cesium.DeveloperError;
var Ellipsoid = Cesium.Ellipsoid;
var defaultValue = Cesium.defaultValue;
var defined = Cesium.defined;

var addExtensionsUsed = require('./addExtensionsUsed');

module.exports = addCesiumRTC;

/**
 * Positions the model relative to a center point using the CESIUM_RTC extension.
 * Either specify options.position directly or calculate it from longitude, latitude and height
 * along with an ellipsoid (WGS84 if not specified).
 *
 * @param {Object} gltf A javascript object containing a glTF asset.
 * @param {Object} [options] Defines the relationship with the center position
 * @param {Cartesian3} [options.position] Places the model relative to a particular position.
 * @param {Number} [options.longitude] The longitude to map onto the ellipsoid.
 * @param {Number} [options.latitude] The latitude to map onto the ellipsoid.
github AnalyticalGraphicsInc / 3d-tiles-tools / tools / lib / optimizeGlb.js View on Github external
'use strict';
var Cesium = require('cesium');
var GltfPipeline = require('gltf-pipeline');

var Cartesian3 = Cesium.Cartesian3;
var DeveloperError = Cesium.DeveloperError;
var defaultValue = Cesium.defaultValue;
var defined = Cesium.defined;

var addCesiumRTC = GltfPipeline.addCesiumRTC;
var getBinaryGltf = GltfPipeline.getBinaryGltf;
var loadGltfUris = GltfPipeline.loadGltfUris;
var parseBinaryGltf = GltfPipeline.parseBinaryGltf;
var Pipeline = GltfPipeline.Pipeline;

module.exports = optimizeGlb;

/**
 * Given an input buffer containing a binary glTF asset, optimize it using gltf-pipeline with the provided options
 *
 * @param {Buffer} glbBuffer The buffer containing the binary glTF.
 * @param {Object} [options] Options specifying custom gltf-pipeline behavior.
 * @returns {Promise} A promise that resolves to the optimized binary glTF.
github AnalyticalGraphicsInc / 3d-tiles-tools / tools / lib / upgradeTileset.js View on Github external
var zlib = require('zlib');
var extractB3dm = require('./extractB3dm');
var extractCmpt = require('./extractCmpt');
var getDefaultWriteCallback = require('./getDefaultWriteCallback');
var getMagic = require('./getMagic');
var glbToB3dm = require('./glbToB3dm');
var isGzippedFile = require('./isGzippedFile');
var isJson = require('./isJson');
var isTile = require('./isTile');
var makeCompositeTile = require('./makeCompositeTile');
var optimizeGlb = require('./optimizeGlb');
var readFile = require('./readFile');
var walkDirectory = require('./walkDirectory');

var Check = Cesium.Check;
var defaultValue = Cesium.defaultValue;
var defined = Cesium.defined;

module.exports = upgradeTileset;

/**
 * Upgrades the input tileset to the latest version of the 3D Tiles spec. Embedded glTF models will be upgraded to glTF 2.0.
 *
 * @param {Object} options Object with the following properties:
 * @param {String} options.inputDirectory Path to the input directory.
 * @param {Object} [options.outputDirectory] Path to the output directory.
 * @param {WriteCallback} [options.writeCallback] A callback function that writes files after they have been processed.
 * @param {LogCallback} [options.logCallback] A callback function that logs messages.
 *
 * @returns {Promise} A promise that resolves when the operation completes.
 */
function upgradeTileset(options) {