@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 2.5 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
*/
import{_ as t}from"../chunks/tslib.es6.js";import e from"../Viewpoint.js";import o from"../core/Error.js";import r from"../core/Identifiable.js";import i from"../core/JSONSupport.js";import{clone as n}from"../core/lang.js";import s from"../core/Logger.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import{cast as m}from"../core/accessorSupport/decorators/cast.js";import{reader as a}from"../core/accessorSupport/decorators/reader.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{writer as c}from"../core/accessorSupport/decorators/writer.js";import{ensureType as u}from"../core/accessorSupport/ensureType.js";import{SlideThumbnail as w}from"../webdoc/support/SlideThumbnail.js";import{timeExtent as d}from"../webdoc/support/timeProperties.js";var h;let f=h=class extends(r.IdentifiableMixin(i)){constructor(t){super(t),this.name=null,this.thumbnail=new w,this.timeExtent=null}castThumbnail(t){return"string"==typeof t?new w({url:t}):u(w,t)}set viewpoint(t){const{targetGeometry:e,scale:o}=t;null!=e&&"point"===e.type&&null==o&&s.getLogger(this).warn("Bookmark.viewpoint should include 'scale' when its targetGeometry is a point.",t),this._set("viewpoint",t)}readViewpoint(t,o){const{extent:r,viewpoint:i}=o;return e.fromJSON(i||{targetGeometry:r})}writeViewpoint(t,e,r,i){if(!t)return;const{targetGeometry:n}=t;if(null==n||"extent"===n.type)null!=n&&(e.extent=n.toJSON()),e[r]=t.toJSON();else{const t="Bookmark.viewpoint cannot be written to JSON when the viewpoint's targetGeometry is not an extent.";i?.messages?i.messages.push(new o("property:unsupported",t)):s.getLogger(this).error(t)}}clone(){return new h(n({name:this.name,thumbnail:this.thumbnail,timeExtent:this.timeExtent,viewpoint:this.viewpoint}))}};t([p({type:String,nonNullable:!0,json:{write:{isRequired:!0}}})],f.prototype,"name",void 0),t([p({type:w,json:{write:{overridePolicy:t=>({enabled:!(!t||!t.url)})}}})],f.prototype,"thumbnail",void 0),t([m("thumbnail")],f.prototype,"castThumbnail",null),t([p(d)],f.prototype,"timeExtent",void 0),t([p({type:e,nonNullable:!0,json:{write:!0}})],f.prototype,"viewpoint",null),t([a("viewpoint",["extent","viewpoint"])],f.prototype,"readViewpoint",null),t([c("viewpoint")],f.prototype,"writeViewpoint",null),f=h=t([l("esri.webmap.Bookmark")],f);const y=f;export{y as default};