How to use calculateId method in devicefarmer-stf

Best JavaScript code snippet using devicefarmer-stf

ClipMacros.js

Source:ClipMacros.js Github

copy

Full Screen

1// Class: altern.geom.ClipMacros2var $global = typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this3$global.Object.defineProperty(exports, "__esModule", {value: true});4var __map_reserved = {};5// Imports6var $hxClasses = require("./../../hxClasses_stub").default;7var $import = require("./../../import_stub").default;8function altern_geom_Wrapper() {return require("./../../altern/geom/Wrapper");}9function util_geom_Vec3() {return require("./../../util/geom/Vec3");}10function altern_geom_Vertex() {return require("./../../altern/geom/Vertex");}11function altern_geom_Face() {return require("./../../altern/geom/Face");}12// Constructor13class ClipMacros {14 constructor() {15 }16 deepCloneWrapper(wrapper) {17 var wrapperClone = (altern_geom_Wrapper().default).create();18 wrapperClone.vertex = wrapper.vertex;19 var w = wrapper.next;20 var tailWrapper = wrapperClone;21 while(w != null) {22 var wClone = (altern_geom_Wrapper().default).create();23 wClone.vertex = w.vertex;24 tailWrapper.next = wClone;25 tailWrapper = wClone;26 w = w.next;27 }28 return wrapperClone;29 }30 static get DUMMY_VECTOR() { return DUMMY_VECTOR; }31 static set DUMMY_VECTOR(value) { DUMMY_VECTOR = value; }32 static get transformId() { return transformId; }33 static set transformId(value) { transformId = value; }34 static computeMeshVerticesLocalOffsets(faceList,camNormal) {35 var wrapper;36 var f;37 ClipMacros.transformId++;38 f = faceList;39 while(f != null) {40 wrapper = f.wrapper;41 while(wrapper != null) {42 var vertex = wrapper.vertex;43 if(vertex.transformId != ClipMacros.transformId) {44 vertex.offset = vertex.x * camNormal.x + vertex.y * camNormal.y + vertex.z * camNormal.z;45 vertex.transformId = ClipMacros.transformId;46 }47 wrapper = wrapper.next;48 }49 f = f.processNext;50 }51 }52 static getClippedVerticesForFace(face,normal,offset,tailWrapper,wrapperClone) {53 var nextWrapper;54 var headWrapper = null;55 var w;56 var wClone;57 var a = tailWrapper.vertex;58 var ao = a.offset;59 var bo;60 var b;61 var ratio;62 var v;63 w = wrapperClone;64 while(w != null) {65 nextWrapper = w.next;66 b = w.vertex;67 bo = b.offset;68 if(bo > offset && ao <= offset || bo <= offset && ao > offset) {69 v = (altern_geom_Vertex().default).create();70 ratio = (offset - ao) / (bo - ao);71 v.cameraX = a.cameraX + (b.cameraX - a.cameraX) * ratio;72 v.cameraY = a.cameraY + (b.cameraY - a.cameraY) * ratio;73 v.cameraZ = a.cameraZ + (b.cameraZ - a.cameraZ) * ratio;74 v.x = a.x + (b.x - a.x) * ratio;75 v.y = a.y + (b.y - a.y) * ratio;76 v.z = a.z + (b.z - a.z) * ratio;77 wClone = (altern_geom_Wrapper().default).create();78 wClone.vertex = v;79 if(headWrapper != null) {80 tailWrapper.next = wClone;81 } else {82 headWrapper = wClone;83 }84 tailWrapper = wClone;85 }86 if(bo > offset) {87 if(headWrapper != null) {88 tailWrapper.next = w;89 } else {90 headWrapper = w;91 }92 tailWrapper = w;93 w.next = null;94 } else {95 w.vertex = null;96 w.next = (altern_geom_Wrapper().default).collector;97 (altern_geom_Wrapper().default).collector = w;98 }99 a = b;100 ao = bo;101 w = nextWrapper;102 }103 return headWrapper;104 }105 static calculateFaceCoordinates2(faceList,faceReference) {106 var calculateId = ++ClipMacros.transformId;107 var origin = faceReference.wrapper.next.vertex;108 var top = faceReference.wrapper.vertex;109 var right = faceReference.wrapper.next.next.vertex;110 var topX = top.x - origin.x;111 var topY = top.y - origin.y;112 var topZ = top.z - origin.z;113 var rightX = right.x - origin.x;114 var rightY = right.y - origin.y;115 var rightZ = right.z - origin.z;116 var d;117 var topD = Math.sqrt(topX * topX + topY * topY + topZ * topZ);118 d = 1 / topD;119 topX *= d;120 topY *= d;121 topZ *= d;122 var rightD = Math.sqrt(rightX * rightX + rightY * rightY + rightZ * rightZ);123 d = 1 / rightD;124 rightX *= d;125 rightY *= d;126 rightZ *= d;127 var vx;128 var vy;129 var vz;130 var f = faceList;131 while(f != null) {132 var w = f.wrapper;133 while(w != null) {134 var v = w.vertex;135 if(v.transformId != calculateId) {136 v.transformId = calculateId;137 vx = v.x - origin.x;138 vy = v.y - origin.y;139 vz = v.z - origin.z;140 v.cameraX = vx * rightX + vy * rightY + vz * rightZ;141 v.cameraY = vx * topX + vy * topY + vz * topZ;142 }143 w = w.next;144 }145 f = f.next;146 }147 }148 static calculateFaceCoordinates(faceList,top,right,origin) {149 var calculateId = ++ClipMacros.transformId;150 var topX = top.x;151 var topY = top.y;152 var topZ = top.z;153 var rightX = right.x;154 var rightY = right.y;155 var rightZ = right.z;156 var vx;157 var vy;158 var vz;159 var f = faceList;160 while(f != null) {161 var w = f.wrapper;162 while(w != null) {163 var v = w.vertex;164 if(v.transformId != calculateId) {165 v.transformId = calculateId;166 vx = v.x - origin.x;167 vy = v.y - origin.y;168 vz = v.z - origin.z;169 v.cameraX = vx * rightX + vy * rightY + vz * rightZ;170 v.cameraY = vx * topX + vy * topY + vz * topZ;171 }172 w = w.next;173 }174 f = f.next;175 }176 }177 static updateClipFace(face,normal,offset) {178 var w = face.wrapper;179 var tailWrapper = w;180 while(w != null) {181 tailWrapper = w;182 w = w.next;183 }184 face.wrapper = ClipMacros.getClippedVerticesForFace(face,normal,offset,tailWrapper,face.wrapper);185 }186 static newPositiveClipFace(face,normal,offset) {187 var clipFace = (altern_geom_Face().default).create();188 clipFace.offset = face.offset;189 clipFace.normalX = face.normalX;190 clipFace.normalY = face.normalY;191 clipFace.normalZ = face.normalZ;192 var wrapper = face.wrapper;193 var wrapperClone = (altern_geom_Wrapper().default).create();194 wrapperClone.vertex = wrapper.vertex;195 var w = wrapper.next;196 var tailWrapper = wrapperClone;197 var wClone;198 while(w != null) {199 wClone = (altern_geom_Wrapper().default).create();200 wClone.vertex = w.vertex;201 tailWrapper.next = wClone;202 tailWrapper = wClone;203 w = w.next;204 }205 clipFace.wrapper = ClipMacros.getClippedVerticesForFace(face,normal,offset,tailWrapper,wrapperClone);206 return clipFace;207 }208 static getOverlapClipFace(clipperFace,face) {209 var v;210 var w;211 var ax;212 var ay;213 var az;214 var bx;215 var by;216 var bz;217 var negativeFace = null;218 ax = clipperFace.normalX;219 ay = clipperFace.normalY;220 az = clipperFace.normalZ;221 var inputNorm = ClipMacros.DUMMY_VECTOR;222 w = clipperFace.wrapper;223 while(w != null) {224 v = w.vertex;225 var v2 = w.next != null ? w.next.vertex : clipperFace.wrapper.vertex;226 bx = v2.x - v.x;227 by = v2.y - v.y;228 bz = v2.z - v.z;229 var d = 1 / Math.sqrt(bx * bx + by * by + bz * bz);230 bx *= d;231 by *= d;232 bz *= d;233 inputNorm.x = bz * ay - by * az;234 inputNorm.y = bx * az - bz * ax;235 inputNorm.z = by * ax - bx * ay;236 var offset = v.x * inputNorm.x + v.y * inputNorm.y + v.z * inputNorm.z;237 ClipMacros.computeMeshVerticesLocalOffsets(face,inputNorm);238 if(negativeFace == null) {239 negativeFace = ClipMacros.newPositiveClipFace(face,inputNorm,offset);240 } else {241 ClipMacros.updateClipFace(face,inputNorm,offset);242 }243 if(negativeFace.wrapper == null) {244 negativeFace = null;245 }246 face = negativeFace;247 if(face == null) {248 break;249 }250 w = w.next;251 }252 if(negativeFace != null) {253 return negativeFace;254 }255 return null;256 }257 static clipWithPlaneList(planeList,disposableFace,clipMask) {258 if(clipMask == null) {259 clipMask = 0;260 }261 var p;262 var f = disposableFace;263 var negativeFace = null;264 var inputNorm = ClipMacros.DUMMY_VECTOR;265 var count = 0;266 p = planeList;267 while(p != null) {268 if((clipMask & 1 << count) != 0) {269 ++count;270 p = p.next;271 continue;272 }273 inputNorm.x = -p.x;274 inputNorm.y = -p.y;275 inputNorm.z = -p.z;276 var offset = -p.offset;277 ClipMacros.computeMeshVerticesLocalOffsets(f,inputNorm);278 if(negativeFace == null) {279 negativeFace = ClipMacros.newPositiveClipFace(f,inputNorm,offset);280 } else {281 ClipMacros.updateClipFace(f,inputNorm,offset);282 }283 if(negativeFace.wrapper == null) {284 negativeFace = null;285 }286 f = negativeFace;287 if(f == null) {288 break;289 }290 ++count;291 p = p.next;292 }293 if(negativeFace != null) {294 return negativeFace;295 }296 return null;297 }298}299// Meta300ClipMacros.__name__ = ["altern","geom","ClipMacros"];301ClipMacros.prototype.__class__ = ClipMacros.prototype.constructor = $hxClasses["altern.geom.ClipMacros"] = ClipMacros;302// Init303// Statics304var DUMMY_VECTOR = new (util_geom_Vec3().default)();305var transformId = 0;306// Export...

Full Screen

Full Screen

index.jsx

Source:index.jsx Github

copy

Full Screen

1/**2* 服务费试算详情页面 Finance/Rules/Calculate/Detail3 */4import React, { Component } from 'react';5import dot from 'dot-prop';6import { connect } from 'dva';7import PropTypes from 'prop-types';8import DistrictsDetail from './districts';9import CourierDetail from './courier';10import CalculateSummary from './summary';11import styles from './style/index.less';12import { CoreContent, CoreTabs } from '../../../../../components/core';13import { FinanceSalaryDetailType, ExpenseCostCenterType } from '../../../../../application/define';14class CalculateDetail extends Component {15 static propTypes = {16 addressInfo: PropTypes.object, // 商圈数据列表17 }18 static defaultProps = {19 addressInfo: {},20 }21 constructor(props) {22 super(props);23 this.state = {24 courier: '骑士维度明细表',25 districts: '商圈维度明细表',26 };27 }28 componentDidMount = () => {29 const { calculateId } = this.props.location.query;30 const params = {31 taskId: calculateId,32 };33 this.props.dispatch({ type: 'financePlan/fetchSalaryPlanAddressInfo', payload: params });34 }35 // tabel的改变36 onChange = (e) => {37 const { calculateId } = this.props.location.query;38 const { courier } = this.state;39 const courierParams = {40 taskId: calculateId,41 type: ExpenseCostCenterType.knight,42 };43 const districtsParams = {44 taskId: calculateId,45 type: ExpenseCostCenterType.district,46 };47 if (e === courier) {48 // 刷新骑士维度明细列表49 this.props.dispatch({ type: 'financePlan/fetchCourierDetailData', payload: courierParams });50 } else {51 // 刷新商圈明细列表52 this.props.dispatch({ type: 'financePlan/fetchDistrictsDetailData', payload: districtsParams });53 }54 }55 // 渲染的城市与商圈56 renderAddress = () => {57 const { addressInfo } = this.props;58 const addressInfoData = dot.get(addressInfo, 'data', []);59 return (<div>60 {61 addressInfoData.map((item, index) => {62 return <h1 key={index} className={styles['app-comp-finance-Ifont']} > {item.bizDistrictName ? `${item.cityName}-${item.bizDistrictName}` : item.cityName} </h1>;63 })64 }65 </div>);66 }67 // 渲染城市-试算汇总68 renderCalculateSummary = () => {69 const { calculateId } = this.props.location.query;70 return (<CalculateSummary calculateId={calculateId} />);71 }72 // 渲染商圈明细Tabel73 renderTabs = () => {74 const { calculateId } = this.props.location.query;75 const { districts } = this.state;76 const items = [77 { title: '商圈维度明细表', content: <DistrictsDetail type={FinanceSalaryDetailType.districts} calculateId={calculateId} />, key: '商圈维度明细表' },78 { title: '骑士维度明细表', content: <CourierDetail type={FinanceSalaryDetailType.courier} calculateId={calculateId} />, key: '骑士维度明细表' },79 ];80 return (81 <div className={styles['app-comp-finance-Wrap']}>82 <CoreContent title="明细表">83 <CoreTabs items={items} onChange={this.onChange} defaultActiveKey={districts} />84 </CoreContent>85 </div>86 );87 }88 render() {89 return (90 <div>91 {/* 渲染的城市与商圈 */}92 {this.renderAddress()}93 {/* 渲染试算汇总 */}94 {this.renderCalculateSummary()}95 {/* 渲染商圈明细Tabel */}96 {this.renderTabs()}97 </div>98 );99 }100}101function mapStateToProps({ financePlan: { addressInfo } }) {102 return { addressInfo };103}...

Full Screen

Full Screen

data-utils.js

Source:data-utils.js Github

copy

Full Screen

1"use strict";2const fp = require("fastify-plugin");3const catToPrefix = {4 electronics: "A",5 confectionery: "B",6};7const calculateID = (idPrefix, data) => {8 const sorted = [...new Set(data.map(({ id }) => id))];9 const next = Number(sorted.pop().slice(1)) + 1;10 return `${idPrefix}${next}`;11};12module.exports = fp(async function (fastify, opts) {13 fastify.decorateRequest("mockDataInsert", function insert(category, data) {14 const request = this;15 const idPrefix = catToPrefix[category];16 const id = calculateID(idPrefix, data);17 data.push({ id, ...request.body });18 });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var stf = require('devicefarmer-stf');2var id = stf.calculateId('test');3console.log(id);4var stf = require('devicefarmer-stf');5var id = stf.calculateId('test');6console.log(id);7var stf = require('devicefarmer-stf');8var id = stf.calculateId('test');9console.log(id);10var stf = require('devicefarmer-stf');11var id = stf.calculateId('test');12console.log(id);13var stf = require('devicefarmer-stf');14var id = stf.calculateId('test');15console.log(id);16var stf = require('devicefarmer-stf');17var id = stf.calculateId('test');18console.log(id);19var stf = require('devicefarmer-stf');20var id = stf.calculateId('test');21console.log(id);22var stf = require('devicefarmer-stf');23var id = stf.calculateId('test');24console.log(id);25var stf = require('devicefarmer-stf');26var id = stf.calculateId('test');27console.log(id);28var stf = require('devicefarmer-stf');29var id = stf.calculateId('test');30console.log(id);31var stf = require('devicefarmer-stf');32var id = stf.calculateId('test');33console.log(id);34var stf = require('devicefarmer-stf');35var id = stf.calculateId('test');36console.log(id);37var stf = require('devicefarmer-stf');

Full Screen

Using AI Code Generation

copy

Full Screen

1var calculateId = require('devicefarmer-stf').calculateId;2var id = calculateId('emulator-5554');3console.log(id);4var calculateId = require('devicefarmer-stf').calculateId;5var id = calculateId('emulator-5554');6console.log(id);7var id = calculateId('emulator-5554');8console.log(id);

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run devicefarmer-stf automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful