UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

6 lines (5 loc) 7.42 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import e from"../../geometry/Point.js";import t from"../../geometry/Polygon.js";import r from"../../geometry/Polyline.js";import n from"../support/TelemetryData.js";import o from"../support/VideoTimeExtent.js";import{applyCIMSymbolColor as i}from"../../symbols/support/cimSymbolUtils.js";import{applyColorToSymbol as a}from"../../symbols/support/utils.js";const u="application/x-mpegURL",s="video/mp4",l="video/webm",d={UASDatalinkLocalSet:1e4,PrecisionTimeStamp:10002,MissionId:10003,PlatformTailNumber:10004,PlatformHeadingAngle:10005,PlatformPitchAngle:10006,PlatformRollAngle:10007,PlatformTrueAirspeed:10008,PlatformIndicatedAirspeed:10009,PlatformDesignation:10010,ImageSourceSensor:10011,ImageCoordinateSystem:10012,SensorLatitude:10013,SensorLongitude:10014,SensorTrueAltitude:10015,SensorHorizontalFOV:10016,SensorVerticalFOV:10017,SensorAzimuthAngle:10018,SensorElevationAngle:10019,SensorRollAngle:10020,PlatformSlantRange:10021,TargetWidth:10022,FrameCenterLatitude:10023,FrameCenterLongitude:10024,FrameCenterElevation:10025,OffsetCorner1Latitude:10026,OffsetCorner1Longitude:10027,OffsetCorner2Latitude:10028,OffsetCorner2Longitude:10029,OffsetCorner3Latitude:10030,OffsetCorner3Longitude:10031,OffsetCorner4Latitude:10032,OffsetCorner4Longitude:10033,TargetLocationLatitude:10040,TargetLocationLongitude:10041,TargetLocationElevation:10042,TargetTrackGateWidth:10043,TargetTrackGateHeight:10044,TargetErrorEstimateHorizontal:10045,TargetErrorEstimateLateral:10046,GenericFlagData:10047,PlatformGroundSpeed:10056,PlatformGroundRange:10057,PlatformRemainingFuel:10058,PlatformCallSign:10059,SensorFOVName:10063,PlatformMagneticHeading:10064,LDSVersionNumber:10065,AlternatePlatformName:10070,EventStartTimeUTC:10072,VMTIDataSet:10074,SensorEllipsoidHeight:10075,OperationalMode:10077,FrameCenterAboveEllipsoid:10078,CornerLatitudePoint1:10082,CornerLongitudePoint1:10083,CornerLatitudePoint2:10084,CornerLongitudePoint2:10085,CornerLatitudePoint3:10086,CornerLongitudePoint3:10087,CornerLatitudePoint4:10088,CornerLongitudePoint4:10089,SARMotionImageryMetadata:10095,SecurityClassification:20001,SecurityClassifyingAuthority:20002,SecurityClassifyingCountry:20003,SecuritySCI:20004,SecurityCaveats:20005,SecurityReleaseInstructions:20006,SecurityLDSVersion:20022,EsriVideoWidth:90001,EsriVideoHeight:90002,EsriFrameCenterLatitude:90050,EsriFrameCenterLongitude:90051,EsriCornerLatitudePt1:90052,EsriCornerLongitudePt1:90053,EsriCornerLatitudePt2:90054,EsriCornerLongitudePt2:90055,EsriCornerLatitudePt3:90056,EsriCornerLongitudePt3:90057,EsriCornerLatitudePt4:90058,EsriCornerLongitudePt4:90059,EsriFrameOutline:90060,EsriSensorPosition:90061,EsriHorizonPixelPack:90063,EsriGroundControlPoints:90064};function f(e,t=1e4){if(!e||!e.length)return[];let r=[],n=[];for(let i=0;i<e.length;i++){const t=e[i],n=t?.text?JSON.parse(t.text):null;"EsriVideoServer"===n?.source&&(r=[...n.data])}const o=r.find((e=>e.tagId===t));return Array.isArray(o?.value)&&(n=[...o.value]),n}function g(e){const{duration:t,end:r,start:n,timezone:i="UTC"}=e||{};return"number"!=typeof t?null:new o({duration:t||null,end:"number"==typeof r?new Date(r):null,start:"number"==typeof n?new Date(n):null,timezone:i})}function m(e,t){const r=[...t],n=r.findIndex((t=>t.equals(e)));return n>-1&&r.splice(n),r.push(e),r}function C(e){if(!e?.size)return new n;const t=b(e),r=P(e),o=O(e),i=A(t,r);return new n({frameCenter:r,frameOutline:o,lineOfSight:i,sensorLocation:t})}function L(e){if(!e?.size)return null;return e.get(d.EsriGroundControlPoints)?.value??null??null}function c(e){return e?.size?e.get(d.EsriHorizonPixelPack)?.value??null:null}function P(e){return S(e)??y(e)}function E(e){if(!e)return u;const t=e.match(/\.(\w{3,4})(?:$|\?)/i);if(!t)return u;switch(t[1].toLowerCase()){case"mp4":return s;case"webm":return l;default:return u}}function p(e){const t=e?.layers;return t?.length?t.map((e=>({layerId:e.id,posterUrl:e.poster,sourceType:e.serviceType,title:e.name,type:e.type||"Video Layer"}))):[]}function v(e,t,r){if(!e)return null;const n=e.clone();switch(n.type){case"simple-fill":a(n,r),n.outline.color=t;break;case"simple-line":a(n,t);break;case"simple-marker":a(n,t),n?.outline?.color&&(n.outline.color=t);break;case"cim":i(n,t)}return n}function h(e){const{cameraAzimuth:t,platformHeading:r,source:n=null,symbolOffset:o=0}=e||{};let i=0;if(!n)return i;i="platformHeading"===n?r+o:r+t+o;const a=i>360?i-360:i;return Math.round(Math.abs(a))}function S(t){return t&&t.has(d.EsriFrameCenterLatitude)&&t.has(d.EsriFrameCenterLongitude)?new e({x:t.get(d.EsriFrameCenterLongitude).value,y:t.get(d.EsriFrameCenterLatitude).value,z:t.get(d.FrameCenterAboveEllipsoid)?.value??t.get(d.FrameCenterElevation)?.value}):null}function y(t){return t&&t.has(d.FrameCenterLatitude)&&t.has(d.FrameCenterLongitude)?new e({x:t.get(d.FrameCenterLongitude)?.value,y:t.get(d.FrameCenterLatitude)?.value,z:t.get(d.FrameCenterElevation)?.value}):null}function O(e){if(!e)return null;const r=e.get(d.EsriFrameOutline)?.value;return r?t.fromJSON(r.geometry):F(e)??T(e)}function F(e){if(!(e.has(d.EsriCornerLatitudePt1)&&e.has(d.EsriCornerLongitudePt1)&&e.has(d.EsriCornerLatitudePt2)&&e.has(d.EsriCornerLongitudePt2)&&e.has(d.EsriCornerLatitudePt3)&&e.has(d.EsriCornerLongitudePt3)&&e.has(d.EsriCornerLatitudePt4)&&e.has(d.EsriCornerLongitudePt4)))return null;const r=[e.get(d.EsriCornerLongitudePt1)?.value,e.get(d.EsriCornerLatitudePt1)?.value],n=[e.get(d.EsriCornerLongitudePt2)?.value,e.get(d.EsriCornerLatitudePt2)?.value],o=[e.get(d.EsriCornerLongitudePt3)?.value,e.get(d.EsriCornerLatitudePt3)?.value],i=[e.get(d.EsriCornerLongitudePt4)?.value,e.get(d.EsriCornerLatitudePt4)?.value];return new t({rings:[[r,n,o,i]]})}function T(e){if(!(e.has(d.OffsetCorner1Latitude)&&e.has(d.OffsetCorner1Longitude)&&e.has(d.OffsetCorner2Latitude)&&e.has(d.OffsetCorner2Longitude)&&e.has(d.OffsetCorner3Latitude)&&e.has(d.OffsetCorner3Longitude)&&e.has(d.OffsetCorner4Latitude)&&e.has(d.OffsetCorner4Longitude)&&e.has(d.FrameCenterLatitude)&&e.has(d.FrameCenterLongitude)))return null;const r=e.get(d.FrameCenterLatitude)?.value,n=e.get(d.FrameCenterLongitude)?.value,o=r+e.get(d.OffsetCorner1Latitude)?.value,i=n+e.get(d.OffsetCorner1Longitude)?.value,a=r+e.get(d.OffsetCorner2Latitude)?.value,u=n+e.get(d.OffsetCorner2Longitude)?.value,s=r+e.get(d.OffsetCorner3Latitude)?.value,l=n+e.get(d.OffsetCorner3Longitude)?.value,f=r+e.get(d.OffsetCorner4Latitude)?.value,g=n+e.get(d.OffsetCorner4Longitude)?.value;return new t({rings:[[[i,o],[u,a],[l,s],[g,f]]]})}function A(e,t){if(!e||!t)return null;const n=[e.x,e.y,e.z??0],o=[t.x,t.y,t.z??0];return new r({paths:[[n,o]]})}function b(t){if(!t?.size)return null;if(t.has(d.EsriSensorPosition)){const r=t.get(d.EsriSensorPosition)?.value;if(r)return e.fromJSON(r.geometry)}return t.has(d.SensorLongitude)&&t.has(d.SensorLatitude)?new e({x:t.get(d.SensorLongitude)?.value,y:t.get(d.SensorLatitude)?.value,z:t.get(d.SensorTrueAltitude)?.value}):null}export{P as getFrameCenter,c as getFrameHorizonPoints,L as getGroundControlPoints,m as getSensorTrailPoints,p as getServiceLayersInfo,v as getStyledTelemetrySymbol,h as getSymbolDisplayAngle,C as getTelemetryData,f as getVideoMetadataFromCueList,E as getVideoMimeType,g as readVideoTimeExtent,d as videoMetadataEntryId};