You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
8.3 KiB
20 lines
8.3 KiB
// All material copyright Esri, All Rights Reserved, unless otherwise specified. |
|
// See https://js.arcgis.com/4.30/esri/copyright.txt for details. |
|
//>>built |
|
define("../../chunks/tslib.es6 ../../core/Accessor ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass ../../core/libs/gl-matrix-2/factories/mat3f64 ../../core/libs/gl-matrix-2/factories/vec3f64 ../../core/libs/gl-matrix-2/math/mat3 ../../chunks/vec32 ../../geometry/Point ../../geometry/SpatialReference ../../geometry/spatialReferenceEllipsoidUtils ../../geometry/projection/projectBuffer ../../geometry/support/Ellipsoid ./videoUtils".split(" "), |
|
function(h,g,k,D,E,F,C,t,p,y,q,z,u,v,A,B,e){const l=Math.PI/180;g=class extends g{constructor(f){super();this.imageWidth=this.imageHeight=this.averageElevation=0;this.metadataSupportsTransforms=!1;this.sensorVerticalFieldOfView=this.sensorRollAngle=this.sensorPitchAngle=this.sensorLongitude=this.sensorLatitude=this.sensorHorizontalFieldOfView=this.sensorAltitude=this.sensorHeadingAngle=this.platformRollAngle=this.platformPitchAngle=this.platformHeadingAngle=0;this.vttMetadata=new Map;this._createMat3FromValues= |
|
a=>{const b=a[0],c=a[1];a=a[2];return t.fromValues(b[0],c[0],a[0],b[1],c[1],a[1],b[2],c[2],a[2])};this._multiplyMat3=(a,b)=>{const c=t.create();y.multiply(c,a,b);return c};this._transposeMat3=a=>{const b=t.create();y.transpose(b,a);return b};this._calculateCameraFovForward=()=>this._createMat3FromValues([[0,0,1],[Math.tan(.5*this.sensorHorizontalFieldOfView*l),0,0],[0,Math.tan(.5*this.sensorVerticalFieldOfView*l),0]]);this._calculateCameraFovReverse=()=>this._createMat3FromValues([[0,1/Math.tan(.5* |
|
this.sensorHorizontalFieldOfView*l),0],[0,0,1/Math.tan(.5*this.sensorVerticalFieldOfView*l)],[1,0,0]]);this._calculateCameraLook=()=>this._getRotationMatrixZYX(this.sensorHeadingAngle*l,this.sensorPitchAngle*l,this.sensorRollAngle*l);this._calculateImageDimensionsForward=()=>this._createMat3FromValues([[2/this.imageWidth,0,-1],[0,-2/this.imageHeight,-1],[0,0,1]]);this._calculateImageDimensionsReverse=()=>this._createMat3FromValues([[this.imageWidth/2,0,this.imageWidth/2],[0,-this.imageHeight/2,-this.imageHeight/ |
|
2],[0,0,1]]);this._calculatePlatformPositionMatrix=()=>{const a=Math.sin(this.sensorLatitude*l),b=Math.cos(this.sensorLatitude*l),c=Math.sin(this.sensorLongitude*l),d=Math.cos(this.sensorLongitude*l);return this._createMat3FromValues([[-a*d,-c,-b*d],[-a*c,d,-b*c],[b,0,-a]])};this._calculatePlatformOrientation=()=>this._getRotationMatrixZYX(this.platformHeadingAngle*l,this.platformPitchAngle*l,this.platformRollAngle*l);this._extractValues=a=>{this.imageWidth=a.get(e.videoMetadataEntryId.EsriVideoWidth)?.value; |
|
this.imageHeight=a.get(e.videoMetadataEntryId.EsriVideoHeight)?.value;this.sensorAltitude=a.get(e.videoMetadataEntryId.SensorEllipsoidHeight)?.value??a.get(e.videoMetadataEntryId.SensorTrueAltitude)?.value;this.sensorLatitude=a.get(e.videoMetadataEntryId.SensorLatitude)?.value;this.sensorLongitude=a.get(e.videoMetadataEntryId.SensorLongitude)?.value;this.sensorHeadingAngle=a.get(e.videoMetadataEntryId.SensorAzimuthAngle)?.value;this.sensorPitchAngle=a.get(e.videoMetadataEntryId.SensorElevationAngle)?.value; |
|
this.sensorRollAngle=a.get(e.videoMetadataEntryId.SensorRollAngle)?.value;this.sensorHorizontalFieldOfView=a.get(e.videoMetadataEntryId.SensorHorizontalFOV)?.value;this.sensorVerticalFieldOfView=a.get(e.videoMetadataEntryId.SensorVerticalFOV)?.value;this.platformHeadingAngle=a.get(e.videoMetadataEntryId.PlatformHeadingAngle)?.value;this.platformPitchAngle=a.get(e.videoMetadataEntryId.PlatformPitchAngle)?.value;this.platformRollAngle=a.get(e.videoMetadataEntryId.PlatformRollAngle)?.value;this.averageElevation= |
|
a.get(e.videoMetadataEntryId.FrameCenterElevation)?.value||0};this._getRotationMatrixZYX=(a,b,c)=>{const d=Math.cos(a);a=Math.sin(a);const m=Math.cos(b);b=Math.sin(b);const n=Math.cos(c);c=Math.sin(c);return this._createMat3FromValues([[d*m,d*b*c-n*a,a*c+d*n*b],[m*a,d*n+a*b*c,n*a*b-d*c],[-b,m*c,m*n]])};this._initCameraSensor=()=>{var a=this._calculateCameraFovForward();const b=this._calculateCameraFovReverse();var c=this._calculateCameraLook();const d=this._calculateImageDimensionsForward(),m=this._calculateImageDimensionsReverse(), |
|
n=this._calculatePlatformPositionMatrix(),w=this._calculatePlatformOrientation();c=this._multiplyMat3(this._multiplyMat3(n,w),c);this._imageToEarthTransform=this._multiplyMat3(this._multiplyMat3(c,a),d);a=this._multiplyMat3(m,b);this._earthToImageTransform=this._multiplyMat3(a,this._transposeMat3(c));this._platformPositionEcef=this._projectPointToECEF(this.sensorLongitude,this.sensorLatitude,this.sensorAltitude||this.averageElevation)};this._metadataSupportsTransforms=a=>{if(!a?.size)return!1;var b= |
|
a.get(e.videoMetadataEntryId.EsriVideoWidth)?.value??0,c=a.get(e.videoMetadataEntryId.EsriVideoHeight)?.value??0;if(0>=b||0>=c)return!1;b=a.get(e.videoMetadataEntryId.SensorEllipsoidHeight)?.value;c=a.get(e.videoMetadataEntryId.SensorTrueAltitude)?.value;var d=a.get(e.videoMetadataEntryId.SensorLatitude)?.value;const m=a.get(e.videoMetadataEntryId.SensorLongitude)?.value;if(null==b&&null==c||null==d||null==m)return!1;b=a.get(e.videoMetadataEntryId.PlatformHeadingAngle)?.value;c=a.get(e.videoMetadataEntryId.PlatformPitchAngle)?.value; |
|
d=a.get(e.videoMetadataEntryId.PlatformRollAngle)?.value;if(null==b||null==c||null==d)return!1;b=a.get(e.videoMetadataEntryId.SensorHorizontalFOV)?.value;c=a.get(e.videoMetadataEntryId.SensorVerticalFOV)?.value;if(null==b||null==c)return!1;b=a.get(e.videoMetadataEntryId.SensorAzimuthAngle)?.value;c=a.get(e.videoMetadataEntryId.SensorElevationAngle)?.value;a=a.get(e.videoMetadataEntryId.SensorRollAngle)?.value;return null==b||null==c||null==a?!1:!0};this._projectPointToECEF=(a,b,c)=>{const d=[];A.projectBuffer([a, |
|
b,c],u.WGS84,0,d,v.WGS84ECEFSpatialReference,0,1);return new z({x:d[0],y:d[1],z:d[2],spatialReference:v.WGS84ECEFSpatialReference})};this._projectImageVectorToEllipsoid=(a,b)=>{var c=B.earth.semiMajorAxis+b,d=B.earth.semiMinorAxis+b;b=d/c;const {x:m,y:n,z:w}=this._platformPositionEcef;d=p.fromValues(m,n,c/d*(w??this.averageElevation));var r=q.dot(a,a);const x=q.dot(a,d);c=q.dot(d,d)-c*c;c=(-x-Math.sqrt(x*x-r*c))/r;if(0>c)return[NaN,NaN,NaN];r=p.create();q.scaleAndAdd(r,d,a,c);r[2]*=b;return r};f= |
|
f?.videoMetadata;this._set("metadataSupportsTransforms",this._metadataSupportsTransforms(f));this.metadataSupportsTransforms&&(this._extractValues(f),this._initCameraSensor())}transformGeoToImage(f,a,b){var c=this._platformPositionEcef;if(!c)return[0,0];const {x:d,y:m,z:n}=c;c=p.fromValues(d,m,n);a=this._projectPointToECEF(f,a,b||this.averageElevation);f=p.create();a=p.fromValues(a.x,a.y,a.z);q.subtract(f,a,c);q.transformMat3(f,f,this._earthToImageTransform);c=f[0];a=f[1];f=f[2];b=p.fromValues(NaN, |
|
NaN,NaN);isNaN(f)||(b=p.fromValues(c/f,a/f,f/f));return[b[0],b[1]]}transformImageToGeo(f,a){f=p.fromValues(f,a,1);a=p.create();q.transformMat3(a,f,this._imageToEarthTransform);f=this._projectImageVectorToEllipsoid(a,this.averageElevation);if(!isNaN(f[0])){var b=[];A.projectBuffer([f[0],f[1],f[2]],v.WGS84ECEFSpatialReference,0,b,u.WGS84,0,1);b=new z({x:b[0],y:b[1],z:b[2],spatialReference:u.WGS84})}return b}};h.__decorate([k.property()],g.prototype,"averageElevation",void 0);h.__decorate([k.property()], |
|
g.prototype,"imageHeight",void 0);h.__decorate([k.property()],g.prototype,"imageWidth",void 0);h.__decorate([k.property({readOnly:!0})],g.prototype,"metadataSupportsTransforms",void 0);h.__decorate([k.property()],g.prototype,"platformHeadingAngle",void 0);h.__decorate([k.property()],g.prototype,"platformPitchAngle",void 0);h.__decorate([k.property()],g.prototype,"platformRollAngle",void 0);h.__decorate([k.property()],g.prototype,"sensorHeadingAngle",void 0);h.__decorate([k.property()],g.prototype, |
|
"sensorAltitude",void 0);h.__decorate([k.property()],g.prototype,"sensorHorizontalFieldOfView",void 0);h.__decorate([k.property()],g.prototype,"sensorLatitude",void 0);h.__decorate([k.property()],g.prototype,"sensorLongitude",void 0);h.__decorate([k.property()],g.prototype,"sensorPitchAngle",void 0);h.__decorate([k.property()],g.prototype,"sensorRollAngle",void 0);h.__decorate([k.property()],g.prototype,"sensorVerticalFieldOfView",void 0);h.__decorate([k.property()],g.prototype,"vttMetadata",void 0); |
|
return g=h.__decorate([C.subclass("esri.layers.video.VideoCameraSensorModel")],g)}); |