7 | ├── .gitignore ├── docs ├── templates │ └── jaguarjs │ │ ├── .npminstall.done │ │ ├── tmpl │ │ ├── example.tmpl │ │ ├── type.tmpl │ │ ├── source.tmpl │ │ ├── augments.tmpl │ │ ├── mainpage.tmpl │ │ ├── tutorial.tmpl │ │ ├── examples.tmpl │ │ ├── exceptions.tmpl │ │ └── members.tmpl │ │ ├── static │ │ ├── fonts │ │ │ ├── OpenSans-Bold-webfont.eot │ │ │ ├── OpenSans-Bold-webfont.woff │ │ │ ├── OpenSans-Light-webfont.eot │ │ │ ├── OpenSans-Italic-webfont.eot │ │ │ ├── OpenSans-Italic-webfont.woff │ │ │ ├── OpenSans-Light-webfont.woff │ │ │ ├── OpenSans-Regular-webfont.eot │ │ │ ├── OpenSans-BoldItalic-webfont.eot │ │ │ ├── OpenSans-Regular-webfont.woff │ │ │ ├── OpenSans-Semibold-webfont.eot │ │ │ ├── OpenSans-Semibold-webfont.ttf │ │ │ ├── OpenSans-Semibold-webfont.woff │ │ │ ├── OpenSans-BoldItalic-webfont.woff │ │ │ ├── OpenSans-LightItalic-webfont.eot │ │ │ ├── OpenSans-LightItalic-webfont.woff │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ ├── OpenSans-SemiboldItalic-webfont.eot │ │ │ ├── OpenSans-SemiboldItalic-webfont.ttf │ │ │ └── OpenSans-SemiboldItalic-webfont.woff │ │ ├── scripts │ │ │ ├── prettify │ │ │ │ └── lang-css.js │ │ │ ├── linenumber.js │ │ │ └── main.js │ │ └── styles │ │ │ └── prettify-jsdoc.css │ │ ├── package.json │ │ ├── LICENSE │ │ └── README.md └── document │ ├── fonts │ ├── OpenSans-Bold-webfont.eot │ ├── OpenSans-Bold-webfont.woff │ ├── OpenSans-Italic-webfont.eot │ ├── OpenSans-Italic-webfont.woff │ ├── OpenSans-Light-webfont.eot │ ├── OpenSans-Light-webfont.woff │ ├── OpenSans-Regular-webfont.eot │ ├── OpenSans-Regular-webfont.woff │ ├── OpenSans-Semibold-webfont.eot │ ├── OpenSans-Semibold-webfont.ttf │ ├── OpenSans-Semibold-webfont.woff │ ├── OpenSans-BoldItalic-webfont.eot │ ├── OpenSans-BoldItalic-webfont.woff │ ├── OpenSans-LightItalic-webfont.eot │ ├── OpenSans-LightItalic-webfont.woff │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.ttf │ ├── glyphicons-halflings-regular.woff │ ├── OpenSans-SemiboldItalic-webfont.eot │ ├── OpenSans-SemiboldItalic-webfont.ttf │ └── OpenSans-SemiboldItalic-webfont.woff │ ├── scripts │ ├── prettify │ │ └── lang-css.js │ ├── linenumber.js │ └── main.js │ └── styles │ ├── prettify-jsdoc.css │ └── prettify-tomorrow.css ├── src ├── util │ ├── core.js │ ├── array.js │ └── mixin.js ├── ol │ ├── ViewHint.js │ ├── interaction │ │ ├── Property.js │ │ └── DoubleClickZoom.js │ ├── source │ │ ├── common.js │ │ ├── WMTSRequestEncoding.js │ │ ├── State.js │ │ ├── WMSServerType.js │ │ ├── TileEventType.js │ │ └── VectorEventType.js │ ├── ImageState.js │ ├── ViewProperty.js │ ├── events │ │ ├── KeyCode.js │ │ ├── EventType.js │ │ └── Event.js │ ├── webgl │ │ └── ContextEventType.js │ ├── MapProperty.js │ ├── layer │ │ ├── TileProperty.js │ │ ├── Property.js │ │ ├── VectorTileRenderType.js │ │ ├── Vector.js │ │ ├── Tile.js │ │ ├── Image.js │ │ └── BaseImage.js │ ├── format │ │ ├── FormatType.js │ │ ├── XLink.js │ │ ├── filter │ │ │ ├── IsNull.js │ │ │ ├── Or.js │ │ │ ├── And.js │ │ │ ├── Not.js │ │ │ ├── LessThan.js │ │ │ ├── GreaterThan.js │ │ │ ├── LessThanOrEqualTo.js │ │ │ ├── GreaterThanOrEqualTo.js │ │ │ ├── EqualTo.js │ │ │ ├── NotEqualTo.js │ │ │ ├── Filter.js │ │ │ ├── Comparison.js │ │ │ ├── Within.js │ │ │ ├── During.js │ │ │ ├── Contains.js │ │ │ ├── Intersects.js │ │ │ ├── IsBetween.js │ │ │ ├── LogicalNary.js │ │ │ ├── Bbox.js │ │ │ ├── ComparisonBinary.js │ │ │ ├── Spatial.js │ │ │ └── IsLike.js │ │ ├── GML.js │ │ └── XML.js │ ├── style │ │ ├── IconAnchorUnits.js │ │ ├── IconOrigin.js │ │ ├── TextPlacement.js │ │ ├── Circle.js │ │ └── Fill.js │ ├── extent │ │ ├── Corner.js │ │ └── Relationship.js │ ├── pixel.js │ ├── render │ │ ├── canvas │ │ │ ├── BuilderType.js │ │ │ ├── Instruction.js │ │ │ └── LabelCache.js │ │ ├── EventType.js │ │ └── Event.js │ ├── tilegrid │ │ └── common.js │ ├── ObjectEventType.js │ ├── TileState.js │ ├── asserts.js │ ├── worker │ │ ├── version.js │ │ └── webgl.js │ ├── geom │ │ ├── GeometryLayout.js │ │ ├── GeometryType.js │ │ └── flat │ │ │ ├── reverse.js │ │ │ ├── topology.js │ │ │ ├── center.js │ │ │ ├── flip.js │ │ │ ├── segments.js │ │ │ ├── length.js │ │ │ ├── straightchunk.js │ │ │ ├── area.js │ │ │ └── inflate.js │ ├── pointer │ │ ├── EventType.js │ │ └── EventSource.js │ ├── reproj │ │ └── common.js │ ├── functions.js │ ├── CollectionEventType.js │ ├── layer.js │ ├── style.js │ ├── geom.js │ ├── OverlayPositioning.js │ ├── MapEventType.js │ ├── Disposable.js │ ├── vec │ │ └── mat4.js │ ├── proj │ │ ├── Units.js │ │ ├── projections.js │ │ ├── proj4.js │ │ ├── epsg4326.js │ │ └── transforms.js │ ├── colorlike.js │ ├── MapBrowserPointerEvent.js │ ├── uri.js │ ├── util.js │ ├── format.js │ ├── MapEvent.js │ ├── TileCache.js │ ├── has.js │ ├── AssertionError.js │ ├── string.js │ ├── net.js │ ├── easing.js │ ├── MapBrowserEventType.js │ ├── index.js │ ├── source.js │ ├── css.js │ ├── size.js │ ├── loadingstrategy.js │ ├── ImageBase.js │ ├── obj.js │ ├── rotationconstraint.js │ ├── MapBrowserEvent.js │ ├── tilecoord.js │ └── ImageCanvas.js ├── plot │ ├── Constants.js │ ├── plots │ │ ├── Marker.js │ │ ├── AssaultDirection.js │ │ ├── Polygon.js │ │ ├── FreehandLine.js │ │ ├── FreehandPolygon.js │ │ ├── Polyline.js │ │ ├── Curve.js │ │ ├── Rectangle.js │ │ ├── Sector.js │ │ ├── Circle.js │ │ ├── StraightArrow.js │ │ ├── Ellipse.js │ │ ├── Arc.js │ │ ├── Lune.js │ │ ├── Plot.js │ │ ├── ClosedCurve.js │ │ ├── FineArrow.js │ │ ├── SquadCombat.js │ │ ├── GatheringPlace.js │ │ ├── TailedSquadCombat.js │ │ └── TailedAttackArrow.js │ ├── events │ │ ├── DrawEvent.js │ │ ├── FeatureOperatorEvent.js │ │ └── FeatureEvent.js │ ├── PlotTypes.js │ └── style │ │ ├── StyleFactory.js │ │ ├── Style.js │ │ ├── PloyLineStyle.js │ │ ├── PloygonStyle.js │ │ └── MarkerStyle.js ├── index.js └── ol.js ├── demo └── assets │ ├── pencil.png │ └── marker-begin.png ├── .babelrc ├── dist ├── plottingol.css └── ol.css.map ├── rollup.config.normal.js ├── rollup.config.ie.js ├── jsdoc.json ├── package.json └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | 3 | -------------------------------------------------------------------------------- /docs/templates/jaguarjs/.npminstall.done: -------------------------------------------------------------------------------- 1 | Tue Feb 14 2017 10:44:20 GMT+0800 (中国标准时间) -------------------------------------------------------------------------------- /src/util/core.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/src/util/core.js -------------------------------------------------------------------------------- /demo/assets/pencil.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/demo/assets/pencil.png -------------------------------------------------------------------------------- /demo/assets/marker-begin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/demo/assets/marker-begin.png -------------------------------------------------------------------------------- /docs/templates/jaguarjs/tmpl/example.tmpl: -------------------------------------------------------------------------------- 1 | 2 |
3 |
--------------------------------------------------------------------------------
/docs/document/fonts/OpenSans-Bold-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/document/fonts/OpenSans-Bold-webfont.eot
--------------------------------------------------------------------------------
/docs/document/fonts/OpenSans-Bold-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/document/fonts/OpenSans-Bold-webfont.woff
--------------------------------------------------------------------------------
/docs/document/fonts/OpenSans-Italic-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/document/fonts/OpenSans-Italic-webfont.eot
--------------------------------------------------------------------------------
/docs/document/fonts/OpenSans-Italic-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/document/fonts/OpenSans-Italic-webfont.woff
--------------------------------------------------------------------------------
/docs/document/fonts/OpenSans-Light-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/document/fonts/OpenSans-Light-webfont.eot
--------------------------------------------------------------------------------
/docs/document/fonts/OpenSans-Light-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/document/fonts/OpenSans-Light-webfont.woff
--------------------------------------------------------------------------------
/docs/document/fonts/OpenSans-Regular-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/document/fonts/OpenSans-Regular-webfont.eot
--------------------------------------------------------------------------------
/docs/document/fonts/OpenSans-Regular-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/document/fonts/OpenSans-Regular-webfont.woff
--------------------------------------------------------------------------------
/docs/document/fonts/OpenSans-Semibold-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/document/fonts/OpenSans-Semibold-webfont.eot
--------------------------------------------------------------------------------
/docs/document/fonts/OpenSans-Semibold-webfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/document/fonts/OpenSans-Semibold-webfont.ttf
--------------------------------------------------------------------------------
/docs/document/fonts/OpenSans-Semibold-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/document/fonts/OpenSans-Semibold-webfont.woff
--------------------------------------------------------------------------------
/docs/document/fonts/OpenSans-BoldItalic-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/document/fonts/OpenSans-BoldItalic-webfont.eot
--------------------------------------------------------------------------------
/docs/document/fonts/OpenSans-BoldItalic-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/document/fonts/OpenSans-BoldItalic-webfont.woff
--------------------------------------------------------------------------------
/docs/document/fonts/OpenSans-LightItalic-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/document/fonts/OpenSans-LightItalic-webfont.eot
--------------------------------------------------------------------------------
/docs/document/fonts/OpenSans-LightItalic-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/document/fonts/OpenSans-LightItalic-webfont.woff
--------------------------------------------------------------------------------
/docs/document/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/document/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/docs/document/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/document/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/docs/document/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/document/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/docs/document/fonts/OpenSans-SemiboldItalic-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/document/fonts/OpenSans-SemiboldItalic-webfont.eot
--------------------------------------------------------------------------------
/docs/document/fonts/OpenSans-SemiboldItalic-webfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/document/fonts/OpenSans-SemiboldItalic-webfont.ttf
--------------------------------------------------------------------------------
/docs/document/fonts/OpenSans-SemiboldItalic-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/document/fonts/OpenSans-SemiboldItalic-webfont.woff
--------------------------------------------------------------------------------
/docs/templates/jaguarjs/static/fonts/OpenSans-Bold-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/templates/jaguarjs/static/fonts/OpenSans-Bold-webfont.eot
--------------------------------------------------------------------------------
/docs/templates/jaguarjs/static/fonts/OpenSans-Bold-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/templates/jaguarjs/static/fonts/OpenSans-Bold-webfont.woff
--------------------------------------------------------------------------------
/docs/templates/jaguarjs/static/fonts/OpenSans-Light-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/templates/jaguarjs/static/fonts/OpenSans-Light-webfont.eot
--------------------------------------------------------------------------------
/docs/templates/jaguarjs/static/fonts/OpenSans-Italic-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/templates/jaguarjs/static/fonts/OpenSans-Italic-webfont.eot
--------------------------------------------------------------------------------
/docs/templates/jaguarjs/static/fonts/OpenSans-Italic-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/templates/jaguarjs/static/fonts/OpenSans-Italic-webfont.woff
--------------------------------------------------------------------------------
/docs/templates/jaguarjs/static/fonts/OpenSans-Light-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/templates/jaguarjs/static/fonts/OpenSans-Light-webfont.woff
--------------------------------------------------------------------------------
/docs/templates/jaguarjs/static/fonts/OpenSans-Regular-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/templates/jaguarjs/static/fonts/OpenSans-Regular-webfont.eot
--------------------------------------------------------------------------------
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | [
4 | "@babel/env",
5 | {
6 | "modules": false,
7 | "useBuiltIns": "usage"
8 | }
9 | ]
10 | ]
11 | }
--------------------------------------------------------------------------------
/docs/templates/jaguarjs/static/fonts/OpenSans-BoldItalic-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/templates/jaguarjs/static/fonts/OpenSans-BoldItalic-webfont.eot
--------------------------------------------------------------------------------
/docs/templates/jaguarjs/static/fonts/OpenSans-Regular-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/templates/jaguarjs/static/fonts/OpenSans-Regular-webfont.woff
--------------------------------------------------------------------------------
/docs/templates/jaguarjs/static/fonts/OpenSans-Semibold-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/templates/jaguarjs/static/fonts/OpenSans-Semibold-webfont.eot
--------------------------------------------------------------------------------
/docs/templates/jaguarjs/static/fonts/OpenSans-Semibold-webfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/templates/jaguarjs/static/fonts/OpenSans-Semibold-webfont.ttf
--------------------------------------------------------------------------------
/docs/templates/jaguarjs/static/fonts/OpenSans-Semibold-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/templates/jaguarjs/static/fonts/OpenSans-Semibold-webfont.woff
--------------------------------------------------------------------------------
/src/ol/ViewHint.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @module ol/ViewHint
3 | */
4 |
5 | /**
6 | * @enum {number}
7 | */
8 | export default {
9 | ANIMATING: 0,
10 | INTERACTING: 1
11 | };
12 |
--------------------------------------------------------------------------------
/docs/templates/jaguarjs/static/fonts/OpenSans-BoldItalic-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/templates/jaguarjs/static/fonts/OpenSans-BoldItalic-webfont.woff
--------------------------------------------------------------------------------
/docs/templates/jaguarjs/static/fonts/OpenSans-LightItalic-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/templates/jaguarjs/static/fonts/OpenSans-LightItalic-webfont.eot
--------------------------------------------------------------------------------
/docs/templates/jaguarjs/static/fonts/OpenSans-LightItalic-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/templates/jaguarjs/static/fonts/OpenSans-LightItalic-webfont.woff
--------------------------------------------------------------------------------
/docs/templates/jaguarjs/static/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/templates/jaguarjs/static/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/docs/templates/jaguarjs/static/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/templates/jaguarjs/static/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/docs/templates/jaguarjs/static/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/templates/jaguarjs/static/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/src/ol/interaction/Property.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @module ol/interaction/Property
3 | */
4 |
5 | /**
6 | * @enum {string}
7 | */
8 | export default {
9 | ACTIVE: 'active'
10 | };
11 |
--------------------------------------------------------------------------------
/docs/templates/jaguarjs/static/fonts/OpenSans-SemiboldItalic-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/templates/jaguarjs/static/fonts/OpenSans-SemiboldItalic-webfont.eot
--------------------------------------------------------------------------------
/docs/templates/jaguarjs/static/fonts/OpenSans-SemiboldItalic-webfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/templates/jaguarjs/static/fonts/OpenSans-SemiboldItalic-webfont.ttf
--------------------------------------------------------------------------------
/docs/templates/jaguarjs/static/fonts/OpenSans-SemiboldItalic-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/worlddai/plot_ol/HEAD/docs/templates/jaguarjs/static/fonts/OpenSans-SemiboldItalic-webfont.woff
--------------------------------------------------------------------------------
/src/ol/source/common.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @module ol/source/common
3 | */
4 |
5 | /**
6 | * Default WMS version.
7 | * @type {string}
8 | */
9 | export const DEFAULT_WMS_VERSION = '1.3.0';
10 |
--------------------------------------------------------------------------------
/src/ol/ImageState.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @module ol/ImageState
3 | */
4 |
5 | /**
6 | * @enum {number}
7 | */
8 | export default {
9 | IDLE: 0,
10 | LOADING: 1,
11 | LOADED: 2,
12 | ERROR: 3
13 | };
14 |
--------------------------------------------------------------------------------
/src/ol/ViewProperty.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @module ol/ViewProperty
3 | */
4 |
5 | /**
6 | * @enum {string}
7 | */
8 | export default {
9 | CENTER: 'center',
10 | RESOLUTION: 'resolution',
11 | ROTATION: 'rotation'
12 | };
13 |
--------------------------------------------------------------------------------
/src/ol/events/KeyCode.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @module ol/events/KeyCode
3 | */
4 |
5 | /**
6 | * @enum {number}
7 | * @const
8 | */
9 | export default {
10 | LEFT: 37,
11 | UP: 38,
12 | RIGHT: 39,
13 | DOWN: 40
14 | };
15 |
--------------------------------------------------------------------------------
/src/ol/webgl/ContextEventType.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @module ol/webgl/ContextEventType
3 | */
4 |
5 | /**
6 | * @enum {string}
7 | */
8 | export default {
9 | LOST: 'webglcontextlost',
10 | RESTORED: 'webglcontextrestored'
11 | };
12 |
--------------------------------------------------------------------------------
/src/ol/MapProperty.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @module ol/MapProperty
3 | */
4 |
5 | /**
6 | * @enum {string}
7 | */
8 | export default {
9 | LAYERGROUP: 'layergroup',
10 | SIZE: 'size',
11 | TARGET: 'target',
12 | VIEW: 'view'
13 | };
14 |
--------------------------------------------------------------------------------
/src/ol/layer/TileProperty.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @module ol/layer/TileProperty
3 | */
4 |
5 | /**
6 | * @enum {string}
7 | */
8 | export default {
9 | PRELOAD: 'preload',
10 | USE_INTERIM_TILES_ON_ERROR: 'useInterimTilesOnError'
11 | };
12 |
--------------------------------------------------------------------------------
/src/ol/format/FormatType.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @module ol/format/FormatType
3 | */
4 |
5 | /**
6 | * @enum {string}
7 | */
8 | export default {
9 | ARRAY_BUFFER: 'arraybuffer',
10 | JSON: 'json',
11 | TEXT: 'text',
12 | XML: 'xml'
13 | };
14 |
--------------------------------------------------------------------------------
/src/ol/style/IconAnchorUnits.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @module ol/style/IconAnchorUnits
3 | */
4 |
5 | /**
6 | * Icon anchor units. One of 'fraction', 'pixels'.
7 | * @enum {string}
8 | */
9 | export default {
10 | FRACTION: 'fraction',
11 | PIXELS: 'pixels'
12 | };
13 |
--------------------------------------------------------------------------------
/docs/templates/jaguarjs/tmpl/type.tmpl:
--------------------------------------------------------------------------------
1 |
5 |
6 | |
7 |
--------------------------------------------------------------------------------
/src/ol/source/WMTSRequestEncoding.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @module ol/source/WMTSRequestEncoding
3 | */
4 |
5 | /**
6 | * Request encoding. One of 'KVP', 'REST'.
7 | * @enum {string}
8 | */
9 | export default {
10 | KVP: 'KVP', // see spec §8
11 | REST: 'REST' // see spec §10
12 | };
13 |
--------------------------------------------------------------------------------
/docs/templates/jaguarjs/tmpl/source.tmpl:
--------------------------------------------------------------------------------
1 |
4 |
7 |
11 |
12 | /g, '') ?> 13 | 14 | -------------------------------------------------------------------------------- /src/ol/format/filter/Or.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/format/filter/Or 3 | */ 4 | import LogicalNary from './LogicalNary.js'; 5 | 6 | /** 7 | * @classdesc 8 | * Represents a logical `` operator between two ore more filter conditions. 9 | * @api 10 | */ 11 | class Or extends LogicalNary { 12 | 13 | /** 14 | * @param {...import("./Filter.js").default} conditions Conditions. 15 | */ 16 | constructor(conditions) { 17 | super('Or', Array.prototype.slice.call(arguments)); 18 | } 19 | 20 | } 21 | 22 | export default Or; 23 | -------------------------------------------------------------------------------- /src/ol/style/TextPlacement.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/style/TextPlacement 3 | */ 4 | 5 | /** 6 | * Text placement. One of `'point'`, `'line'`. Default is `'point'`. Note that 7 | * `'line'` requires the underlying geometry to be a {@link module:ol/geom/LineString~LineString}, 8 | * {@link module:ol/geom/Polygon~Polygon}, {@link module:ol/geom/MultiLineString~MultiLineString} or 9 | * {@link module:ol/geom/MultiPolygon~MultiPolygon}. 10 | * @enum {string} 11 | */ 12 | export default { 13 | POINT: 'point', 14 | LINE: 'line' 15 | }; 16 | -------------------------------------------------------------------------------- /src/ol/format/filter/And.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/format/filter/And 3 | */ 4 | import LogicalNary from './LogicalNary.js'; 5 | 6 | /** 7 | * @classdesc 8 | * Represents a logical ` ` operator between two or more filter conditions. 9 | * 10 | * @abstract 11 | */ 12 | class And extends LogicalNary { 13 | 14 | /** 15 | * @param {...import("./Filter.js").default} conditions Conditions. 16 | */ 17 | constructor(conditions) { 18 | super('And', Array.prototype.slice.call(arguments)); 19 | } 20 | 21 | } 22 | 23 | export default And; 24 | -------------------------------------------------------------------------------- /src/ol/style.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/style 3 | */ 4 | 5 | export {default as Circle} from './style/Circle.js'; 6 | export {default as Fill} from './style/Fill.js'; 7 | export {default as Icon} from './style/Icon.js'; 8 | export {default as IconImage} from './style/IconImage.js'; 9 | export {default as Image} from './style/Image.js'; 10 | export {default as RegularShape} from './style/RegularShape.js'; 11 | export {default as Stroke} from './style/Stroke.js'; 12 | export {default as Style} from './style/Style.js'; 13 | export {default as Text} from './style/Text.js'; 14 | -------------------------------------------------------------------------------- /src/plot/plots/Marker.js: -------------------------------------------------------------------------------- 1 | 2 | import Plot from './Plot' 3 | import PlotTypes from '../PlotTypes' 4 | import Point from '../../ol/geom/Point' 5 | import mix from '../../util/mixin' 6 | export default class Marker extends mix(Plot,Point) { 7 | 8 | constructor(points) { 9 | super(points); 10 | this.type = PlotTypes.MARKER; 11 | this.fixPointCount = 1; 12 | this.setPoints(points); 13 | } 14 | generate() { 15 | var pnt = this.points[0]; 16 | this.setCoordinates(pnt); 17 | } 18 | } 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /rollup.config.ie.js: -------------------------------------------------------------------------------- 1 | import cjs from 'rollup-plugin-commonjs'; 2 | import node from 'rollup-plugin-node-resolve'; 3 | import {terser} from 'rollup-plugin-terser'; 4 | import babel from 'rollup-plugin-babel'; 5 | 6 | const production = !process.env.ROLLUP_WATCH; 7 | 8 | export default { 9 | input: './src/index.js', 10 | output: [ 11 | {file: './dist/plottingol.js', format: 'iife',name:"POL"}, 12 | ], 13 | plugins: [ 14 | node(), 15 | cjs(), 16 | production && terser(), 17 | production && babel({ 18 | exclude: 'node_modules/**', 19 | }) 20 | ] 21 | }; 22 | -------------------------------------------------------------------------------- /src/plot/plots/AssaultDirection.js: -------------------------------------------------------------------------------- 1 | 2 | import PlotTypes from '../PlotTypes' 3 | import FineArrow from './FineArrow' 4 | export default class AssaultDirection extends FineArrow { 5 | 6 | constructor(points) { 7 | super(points); 8 | this.type = PlotTypes.ASSAULT_DIRECTION; 9 | this.tailWidthFactor = 0.2; 10 | this.neckWidthFactor = 0.25; 11 | this.headWidthFactor = 0.3; 12 | this.headAngle = Math.PI / 4; 13 | this.neckAngle = Math.PI * 0.17741; 14 | this.setPoints(points); 15 | } 16 | } 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /jsdoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "tags": { 3 | "allowUnknownTags": true 4 | }, 5 | "source": { 6 | "include": ["src/plot" 7 | ], 8 | "includePattern": ".js$", 9 | "excludePattern": "(node_modules/|docs)" 10 | }, 11 | "opts": { 12 | "destination": "./docs/document", 13 | "encoding": "utf8", 14 | "private": true, 15 | "recurse": true, 16 | "template": "./docs/templates/jaguarjs" 17 | }, 18 | "plugins": [ 19 | "plugins/markdown" 20 | ], 21 | "templates": { 22 | "cleverLinks": false, 23 | "monospaceLinks": true, 24 | "useLongnameInNav": false 25 | } 26 | } -------------------------------------------------------------------------------- /src/ol/format/filter/Not.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/format/filter/Not 3 | */ 4 | import Filter from './Filter.js'; 5 | 6 | /** 7 | * @classdesc 8 | * Represents a logical ` ` operator for a filter condition. 9 | * @api 10 | */ 11 | class Not extends Filter { 12 | 13 | /** 14 | * @param {!import("./Filter.js").default} condition Filter condition. 15 | */ 16 | constructor(condition) { 17 | 18 | super('Not'); 19 | 20 | /** 21 | * @type {!import("./Filter.js").default} 22 | */ 23 | this.condition = condition; 24 | 25 | } 26 | 27 | } 28 | 29 | export default Not; 30 | -------------------------------------------------------------------------------- /src/plot/plots/Polygon.js: -------------------------------------------------------------------------------- 1 | import Plot from './Plot' 2 | import PlotTypes from '../PlotTypes' 3 | import PolygonOL from '../../ol/geom/Polygon' 4 | import mix from '../../util/mixin' 5 | export default class Polygon extends mix(Plot,PolygonOL) { 6 | 7 | constructor(points) { 8 | super(points); 9 | this.type = PlotTypes.POLYGON; 10 | this.setPoints(points); 11 | } 12 | generate() { 13 | var count = this.getPointCount(); 14 | if (count < 2) { 15 | return; 16 | } 17 | this.setCoordinates([this.points]); 18 | } 19 | 20 | 21 | } 22 | 23 | -------------------------------------------------------------------------------- /src/ol/geom.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/geom 3 | */ 4 | 5 | export {default as Circle} from './geom/Circle.js'; 6 | export {default as Geometry} from './geom/Geometry.js'; 7 | export {default as GeometryCollection} from './geom/GeometryCollection.js'; 8 | export {default as LineString} from './geom/LineString.js'; 9 | export {default as MultiLineString} from './geom/MultiLineString.js'; 10 | export {default as MultiPoint} from './geom/MultiPoint.js'; 11 | export {default as MultiPolygon} from './geom/MultiPolygon.js'; 12 | export {default as Point} from './geom/Point.js'; 13 | export {default as Polygon} from './geom/Polygon.js'; 14 | -------------------------------------------------------------------------------- /src/ol/format/filter/LessThan.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/format/filter/LessThan 3 | */ 4 | import ComparisonBinary from './ComparisonBinary.js'; 5 | 6 | /** 7 | * @classdesc 8 | * Represents a ` ` comparison operator. 9 | * @api 10 | */ 11 | class LessThan extends ComparisonBinary { 12 | 13 | /** 14 | * @param {!string} propertyName Name of the context property to compare. 15 | * @param {!number} expression The value to compare. 16 | */ 17 | constructor(propertyName, expression) { 18 | super('PropertyIsLessThan', propertyName, expression); 19 | } 20 | 21 | } 22 | 23 | export default LessThan; 24 | -------------------------------------------------------------------------------- /src/ol/geom/GeometryType.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/geom/GeometryType 3 | */ 4 | 5 | /** 6 | * The geometry type. One of `'Point'`, `'LineString'`, `'LinearRing'`, 7 | * `'Polygon'`, `'MultiPoint'`, `'MultiLineString'`, `'MultiPolygon'`, 8 | * `'GeometryCollection'`, `'Circle'`. 9 | * @enum {string} 10 | */ 11 | export default { 12 | POINT: 'Point', 13 | LINE_STRING: 'LineString', 14 | LINEAR_RING: 'LinearRing', 15 | POLYGON: 'Polygon', 16 | MULTI_POINT: 'MultiPoint', 17 | MULTI_LINE_STRING: 'MultiLineString', 18 | MULTI_POLYGON: 'MultiPolygon', 19 | GEOMETRY_COLLECTION: 'GeometryCollection', 20 | CIRCLE: 'Circle' 21 | }; 22 | -------------------------------------------------------------------------------- /src/ol/OverlayPositioning.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/OverlayPositioning 3 | */ 4 | 5 | /** 6 | * Overlay position: `'bottom-left'`, `'bottom-center'`, `'bottom-right'`, 7 | * `'center-left'`, `'center-center'`, `'center-right'`, `'top-left'`, 8 | * `'top-center'`, `'top-right'` 9 | * @enum {string} 10 | */ 11 | export default { 12 | BOTTOM_LEFT: 'bottom-left', 13 | BOTTOM_CENTER: 'bottom-center', 14 | BOTTOM_RIGHT: 'bottom-right', 15 | CENTER_LEFT: 'center-left', 16 | CENTER_CENTER: 'center-center', 17 | CENTER_RIGHT: 'center-right', 18 | TOP_LEFT: 'top-left', 19 | TOP_CENTER: 'top-center', 20 | TOP_RIGHT: 'top-right' 21 | }; 22 | -------------------------------------------------------------------------------- /src/ol/format/filter/GreaterThan.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/format/filter/GreaterThan 3 | */ 4 | import ComparisonBinary from './ComparisonBinary.js'; 5 | 6 | /** 7 | * @classdesc 8 | * Represents a ` ` comparison operator. 9 | * @api 10 | */ 11 | class GreaterThan extends ComparisonBinary { 12 | 13 | /** 14 | * @param {!string} propertyName Name of the context property to compare. 15 | * @param {!number} expression The value to compare. 16 | */ 17 | constructor(propertyName, expression) { 18 | super('PropertyIsGreaterThan', propertyName, expression); 19 | } 20 | 21 | } 22 | 23 | export default GreaterThan; 24 | -------------------------------------------------------------------------------- /src/ol/MapEventType.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/MapEventType 3 | */ 4 | 5 | /** 6 | * @enum {string} 7 | */ 8 | export default { 9 | 10 | /** 11 | * Triggered after a map frame is rendered. 12 | * @event module:ol/MapEvent~MapEvent#postrender 13 | * @api 14 | */ 15 | POSTRENDER: 'postrender', 16 | 17 | /** 18 | * Triggered when the map starts moving. 19 | * @event module:ol/MapEvent~MapEvent#movestart 20 | * @api 21 | */ 22 | MOVESTART: 'movestart', 23 | 24 | /** 25 | * Triggered after the map is moved. 26 | * @event module:ol/MapEvent~MapEvent#moveend 27 | * @api 28 | */ 29 | MOVEEND: 'moveend' 30 | 31 | }; 32 | -------------------------------------------------------------------------------- /src/plot/plots/FreehandLine.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | import Plot from './Plot' 4 | import PlotTypes from '../PlotTypes' 5 | import LineString from '../../ol/geom/LineString' 6 | import mix from '../../util/mixin' 7 | 8 | export default class FreehandLine extends mix(Plot, LineString) { 9 | 10 | constructor(points) { 11 | super(points); 12 | this.type = PlotTypes.FREEHAND_LINE; 13 | this.freehand = true; 14 | this.setPoints(points); 15 | } 16 | generate() { 17 | var count = this.getPointCount(); 18 | if (count < 2) { 19 | return; 20 | } 21 | this.setCoordinates(this.points); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/plot/plots/FreehandPolygon.js: -------------------------------------------------------------------------------- 1 | import Plot from './Plot' 2 | import PlotTypes from '../PlotTypes' 3 | import PolygonOL from '../../ol/geom/Polygon' 4 | import mix from '../../util/mixin' 5 | export default class FreehandPolygon extends mix(Plot,PolygonOL) { 6 | 7 | constructor(points) { 8 | super(points); 9 | this.type = PlotTypes.FREEHAND_POLYGON; 10 | this.freehand = true; 11 | this.setPoints(points); 12 | } 13 | generate() { 14 | var count = this.getPointCount(); 15 | if(count < 2) { 16 | return; 17 | } 18 | this.setCoordinates([this.points]); 19 | } 20 | 21 | 22 | } 23 | 24 | -------------------------------------------------------------------------------- /src/ol/geom/flat/reverse.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/geom/flat/reverse 3 | */ 4 | 5 | 6 | /** 7 | * @param {Array } flatCoordinates Flat coordinates. 8 | * @param {number} offset Offset. 9 | * @param {number} end End. 10 | * @param {number} stride Stride. 11 | */ 12 | export function coordinates(flatCoordinates, offset, end, stride) { 13 | while (offset < end - stride) { 14 | for (let i = 0; i < stride; ++i) { 15 | const tmp = flatCoordinates[offset + i]; 16 | flatCoordinates[offset + i] = flatCoordinates[end - stride + i]; 17 | flatCoordinates[end - stride + i] = tmp; 18 | } 19 | offset += stride; 20 | end -= stride; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/ol/format/filter/LessThanOrEqualTo.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/format/filter/LessThanOrEqualTo 3 | */ 4 | import ComparisonBinary from './ComparisonBinary.js'; 5 | 6 | /** 7 | * @classdesc 8 | * Represents a ` ` comparison operator. 9 | * @api 10 | */ 11 | class LessThanOrEqualTo extends ComparisonBinary { 12 | 13 | /** 14 | * @param {!string} propertyName Name of the context property to compare. 15 | * @param {!number} expression The value to compare. 16 | */ 17 | constructor(propertyName, expression) { 18 | super('PropertyIsLessThanOrEqualTo', propertyName, expression); 19 | } 20 | 21 | } 22 | 23 | export default LessThanOrEqualTo; 24 | -------------------------------------------------------------------------------- /src/plot/events/DrawEvent.js: -------------------------------------------------------------------------------- 1 | import Event from '../../ol/events/Event' 2 | 3 | class DrawEvent extends Event { 4 | 5 | /** 6 | * @classdesc 传递Feature的Event 7 | * 用来传递feature 8 | * @constructs 9 | * @extends {ol.Event} 10 | * @author daiyujie 11 | * @param {String} type 事件类型 12 | * @param {ol.Feature} feature 图元 13 | */ 14 | constructor(type, drawstate) { 15 | super(type); 16 | this.drawstate = drawstate; 17 | } 18 | } 19 | /** 20 | * 添加控制点时触发 21 | * @static 22 | */ 23 | DrawEvent.ADD_CONTROL_POINT = 'add_control_point'; 24 | /** 25 | * 绘制过程中的鼠标移动事件 26 | * @static 27 | */ 28 | DrawEvent.ADDING_MOUSE_MOVE = 'adding_mouse_move'; 29 | 30 | export default DrawEvent -------------------------------------------------------------------------------- /src/ol/layer/VectorTileRenderType.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/layer/VectorTileRenderType 3 | */ 4 | 5 | /** 6 | * @enum {string} 7 | * Render mode for vector tiles: 8 | * * `'image'`: Vector tiles are rendered as images. Great performance, but 9 | * point symbols and texts are always rotated with the view and pixels are 10 | * scaled during zoom animations. 11 | * * `'hybrid'`: Polygon and line elements are rendered as images, so pixels 12 | * are scaled during zoom animations. Point symbols and texts are accurately 13 | * rendered as vectors and can stay upright on rotated views. 14 | * @api 15 | */ 16 | export default { 17 | IMAGE: 'image', 18 | HYBRID: 'hybrid' 19 | }; 20 | -------------------------------------------------------------------------------- /src/ol/format/filter/GreaterThanOrEqualTo.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/format/filter/GreaterThanOrEqualTo 3 | */ 4 | import ComparisonBinary from './ComparisonBinary.js'; 5 | 6 | /** 7 | * @classdesc 8 | * Represents a ` ` comparison operator. 9 | * @api 10 | */ 11 | class GreaterThanOrEqualTo extends ComparisonBinary { 12 | 13 | /** 14 | * @param {!string} propertyName Name of the context property to compare. 15 | * @param {!number} expression The value to compare. 16 | */ 17 | constructor(propertyName, expression) { 18 | super('PropertyIsGreaterThanOrEqualTo', propertyName, expression); 19 | } 20 | 21 | } 22 | 23 | export default GreaterThanOrEqualTo; 24 | -------------------------------------------------------------------------------- /src/plot/plots/Polyline.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | import Plot from './Plot' 4 | import PlotTypes from '../PlotTypes' 5 | import LineString from '../../ol/geom/LineString' 6 | import mix from '../../util/mixin' 7 | //--fix dyj 目前mix函数只支持简单对象的拷贝,Plot必须放在复杂对象前面 8 | export default class Polyline extends mix(Plot, LineString) { 9 | 10 | constructor(points) { 11 | super(points); 12 | this.type = PlotTypes.POLYLINE; 13 | this.geo_type ='LineString'; 14 | this.setPoints(points); 15 | } 16 | generate() { 17 | var count = this.getPointCount(); 18 | if (count < 2) { 19 | return; 20 | } 21 | this.setCoordinates(this.points); 22 | } 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/ol/Disposable.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/Disposable 3 | */ 4 | 5 | /** 6 | * @classdesc 7 | * Objects that need to clean up after themselves. 8 | */ 9 | class Disposable { 10 | 11 | constructor() { 12 | /** 13 | * The object has already been disposed. 14 | * @type {boolean} 15 | * @private 16 | */ 17 | this.disposed_ = false; 18 | } 19 | 20 | /** 21 | * Clean up. 22 | */ 23 | dispose() { 24 | if (!this.disposed_) { 25 | this.disposed_ = true; 26 | this.disposeInternal(); 27 | } 28 | } 29 | 30 | /** 31 | * Extension point for disposable objects. 32 | * @protected 33 | */ 34 | disposeInternal() {} 35 | } 36 | 37 | export default Disposable; 38 | -------------------------------------------------------------------------------- /src/ol/format/filter/EqualTo.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/format/filter/EqualTo 3 | */ 4 | import ComparisonBinary from './ComparisonBinary.js'; 5 | 6 | /** 7 | * @classdesc 8 | * Represents a ` ` comparison operator. 9 | * @api 10 | */ 11 | class EqualTo extends ComparisonBinary { 12 | 13 | /** 14 | * @param {!string} propertyName Name of the context property to compare. 15 | * @param {!(string|number)} expression The value to compare. 16 | * @param {boolean=} opt_matchCase Case-sensitive? 17 | */ 18 | constructor(propertyName, expression, opt_matchCase) { 19 | super('PropertyIsEqualTo', propertyName, expression, opt_matchCase); 20 | } 21 | 22 | } 23 | 24 | export default EqualTo; 25 | -------------------------------------------------------------------------------- /src/ol/format/filter/NotEqualTo.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/format/filter/NotEqualTo 3 | */ 4 | import ComparisonBinary from './ComparisonBinary.js'; 5 | 6 | /** 7 | * @classdesc 8 | * Represents a ` ` comparison operator. 9 | * @api 10 | */ 11 | class NotEqualTo extends ComparisonBinary { 12 | 13 | /** 14 | * @param {!string} propertyName Name of the context property to compare. 15 | * @param {!(string|number)} expression The value to compare. 16 | * @param {boolean=} opt_matchCase Case-sensitive? 17 | */ 18 | constructor(propertyName, expression, opt_matchCase) { 19 | super('PropertyIsNotEqualTo', propertyName, expression, opt_matchCase); 20 | } 21 | 22 | } 23 | 24 | export default NotEqualTo; 25 | -------------------------------------------------------------------------------- /src/plot/events/FeatureOperatorEvent.js: -------------------------------------------------------------------------------- 1 | import Event from '../../ol/events/Event' 2 | 3 | class FeatureOperatorEvent extends Event { 4 | /** 5 | * @classdesc 传递FeatureOperator的Event 6 | * 用来传递feature 7 | * @constructs 8 | * @extends {ol.Event} 9 | * @author daiyujie 10 | * @param {String} type 事件类型 11 | * @param {FeatureOperator} feature 图元操作类 12 | */ 13 | constructor(type, feature_operator) { 14 | super(type); 15 | this.feature_operator = feature_operator; 16 | } 17 | } 18 | /** 19 | * 图元被激活时触发 20 | * @static 21 | */ 22 | FeatureOperatorEvent.ACTIVATE = 'activate_feature'; 23 | /** 24 | * 图元被取消激活时触发 25 | * @static 26 | */ 27 | FeatureOperatorEvent.DEACTIVATE = 'deactivate_feature'; 28 | 29 | 30 | export default FeatureOperatorEvent -------------------------------------------------------------------------------- /src/ol/format/filter/Filter.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/format/filter/Filter 3 | */ 4 | 5 | 6 | /** 7 | * @classdesc 8 | * Abstract class; normally only used for creating subclasses and not instantiated in apps. 9 | * Base class for WFS GetFeature filters. 10 | * 11 | * @abstract 12 | */ 13 | class Filter { 14 | /** 15 | * @param {!string} tagName The XML tag name for this filter. 16 | */ 17 | constructor(tagName) { 18 | 19 | /** 20 | * @private 21 | * @type {!string} 22 | */ 23 | this.tagName_ = tagName; 24 | } 25 | 26 | /** 27 | * The XML tag name for a filter. 28 | * @returns {!string} Name. 29 | */ 30 | getTagName() { 31 | return this.tagName_; 32 | } 33 | } 34 | 35 | export default Filter; 36 | -------------------------------------------------------------------------------- /src/plot/PlotTypes.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @enum 3 | */ 4 | const PlotTypes = { 5 | MARKER: 'marker', 6 | POLYLINE: 'polyline', 7 | POLYGON: 'polygon', 8 | CIRCLE:'circle', 9 | ELLIPSE:'ellipse', 10 | RECTANGLE:'rectangle', 11 | ARC:'arc', 12 | ATTACK_ARROW:'attack_arrow', 13 | CLOSED_CURVE:"closed_curve", 14 | CURVE:'curve', 15 | DOUBLE_ARROW:'double_arrow', 16 | FINE_ARROW:'fine_arrow', 17 | ASSAULT_DIRECTION:'assault_direction', 18 | FREEHAND_LINE:'freehand_line', 19 | FREEHAND_POLYGON:'freehand_polygon', 20 | GATHERING_PLACE:'gathering_place', 21 | LUNE:'lune', 22 | SECTOR: 'sector', 23 | SQUAD_COMBAT: 'squad_combat', 24 | STRAIGHT_ARROW:'straight_arrow', 25 | TAILED_ATTACK_ARROW:'tailed_attack_arrow', 26 | TAILED_SQUAD_COMBAT:'tailed_squad_combat' 27 | } 28 | export default PlotTypes; -------------------------------------------------------------------------------- /src/ol/format/filter/Comparison.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/format/filter/Comparison 3 | */ 4 | import Filter from './Filter.js'; 5 | 6 | /** 7 | * @classdesc 8 | * Abstract class; normally only used for creating subclasses and not instantiated in apps. 9 | * Base class for WFS GetFeature property comparison filters. 10 | * 11 | * @abstract 12 | */ 13 | class Comparison extends Filter { 14 | 15 | /** 16 | * @param {!string} tagName The XML tag name for this filter. 17 | * @param {!string} propertyName Name of the context property to compare. 18 | */ 19 | constructor(tagName, propertyName) { 20 | 21 | super(tagName); 22 | 23 | /** 24 | * @type {!string} 25 | */ 26 | this.propertyName = propertyName; 27 | } 28 | 29 | } 30 | 31 | export default Comparison; 32 | -------------------------------------------------------------------------------- /src/ol/format/filter/Within.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/format/filter/Within 3 | */ 4 | import Spatial from './Spatial.js'; 5 | 6 | /** 7 | * @classdesc 8 | * Represents a ` ` operator to test whether a geometry-valued property 9 | * is within a given geometry. 10 | * @api 11 | */ 12 | class Within extends Spatial { 13 | 14 | /** 15 | * @param {!string} geometryName Geometry name to use. 16 | * @param {!import("../../geom/Geometry.js").default} geometry Geometry. 17 | * @param {string=} opt_srsName SRS name. No srsName attribute will be 18 | * set on geometries when this is not provided. 19 | */ 20 | constructor(geometryName, geometry, opt_srsName) { 21 | super('Within', geometryName, geometry, opt_srsName); 22 | } 23 | 24 | } 25 | 26 | export default Within; 27 | -------------------------------------------------------------------------------- /src/ol/vec/mat4.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/vec/mat4 3 | */ 4 | 5 | 6 | /** 7 | * @return {Array } "4x4 matrix representing a 3D identity transform." 8 | */ 9 | export function create() { 10 | return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]; 11 | } 12 | 13 | 14 | /** 15 | * @param {Array } mat4 Flattened 4x4 matrix receiving the result. 16 | * @param {import("../transform.js").Transform} transform Transformation matrix. 17 | * @return {Array } "2D transformation matrix as flattened 4x4 matrix." 18 | */ 19 | export function fromTransform(mat4, transform) { 20 | mat4[0] = transform[0]; 21 | mat4[1] = transform[1]; 22 | mat4[4] = transform[2]; 23 | mat4[5] = transform[3]; 24 | mat4[12] = transform[4]; 25 | mat4[13] = transform[5]; 26 | return mat4; 27 | } 28 | -------------------------------------------------------------------------------- /src/ol/format/filter/During.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/format/filter/During 3 | */ 4 | import Comparison from './Comparison.js'; 5 | 6 | /** 7 | * @classdesc 8 | * Represents a ` ` comparison operator. 9 | * @api 10 | */ 11 | class During extends Comparison { 12 | 13 | /** 14 | * @param {!string} propertyName Name of the context property to compare. 15 | * @param {!string} begin The begin date in ISO-8601 format. 16 | * @param {!string} end The end date in ISO-8601 format. 17 | */ 18 | constructor(propertyName, begin, end) { 19 | super('During', propertyName); 20 | 21 | /** 22 | * @type {!string} 23 | */ 24 | this.begin = begin; 25 | 26 | /** 27 | * @type {!string} 28 | */ 29 | this.end = end; 30 | } 31 | 32 | } 33 | 34 | export default During; 35 | -------------------------------------------------------------------------------- /src/ol/format/filter/Contains.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/format/filter/Contains 3 | */ 4 | import Spatial from './Spatial.js'; 5 | 6 | /** 7 | * @classdesc 8 | * Represents a ` ` operator to test whether a geometry-valued property 9 | * contains a given geometry. 10 | * @api 11 | */ 12 | class Contains extends Spatial { 13 | 14 | /** 15 | * @param {!string} geometryName Geometry name to use. 16 | * @param {!import("../../geom/Geometry.js").default} geometry Geometry. 17 | * @param {string=} opt_srsName SRS name. No srsName attribute will be 18 | * set on geometries when this is not provided. 19 | */ 20 | constructor(geometryName, geometry, opt_srsName) { 21 | 22 | super('Contains', geometryName, geometry, opt_srsName); 23 | 24 | } 25 | 26 | } 27 | 28 | export default Contains; 29 | -------------------------------------------------------------------------------- /src/ol/format/filter/Intersects.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/format/filter/Intersects 3 | */ 4 | import Spatial from './Spatial.js'; 5 | 6 | /** 7 | * @classdesc 8 | * Represents a ` ` operator to test whether a geometry-valued property 9 | * intersects a given geometry. 10 | * @api 11 | */ 12 | class Intersects extends Spatial { 13 | 14 | /** 15 | * @param {!string} geometryName Geometry name to use. 16 | * @param {!import("../../geom/Geometry.js").default} geometry Geometry. 17 | * @param {string=} opt_srsName SRS name. No srsName attribute will be 18 | * set on geometries when this is not provided. 19 | */ 20 | constructor(geometryName, geometry, opt_srsName) { 21 | super('Intersects', geometryName, geometry, opt_srsName); 22 | } 23 | 24 | } 25 | 26 | export default Intersects; 27 | -------------------------------------------------------------------------------- /src/ol/proj/Units.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/proj/Units 3 | */ 4 | 5 | /** 6 | * Projection units: `'degrees'`, `'ft'`, `'m'`, `'pixels'`, `'tile-pixels'` or 7 | * `'us-ft'`. 8 | * @enum {string} 9 | */ 10 | const Units = { 11 | DEGREES: 'degrees', 12 | FEET: 'ft', 13 | METERS: 'm', 14 | PIXELS: 'pixels', 15 | TILE_PIXELS: 'tile-pixels', 16 | USFEET: 'us-ft' 17 | }; 18 | 19 | 20 | /** 21 | * Meters per unit lookup table. 22 | * @const 23 | * @type {Object } 24 | * @api 25 | */ 26 | export const METERS_PER_UNIT = {}; 27 | // use the radius of the Normal sphere 28 | METERS_PER_UNIT[Units.DEGREES] = 2 * Math.PI * 6370997 / 360; 29 | METERS_PER_UNIT[Units.FEET] = 0.3048; 30 | METERS_PER_UNIT[Units.METERS] = 1; 31 | METERS_PER_UNIT[Units.USFEET] = 1200 / 3937; 32 | 33 | export default Units; 34 | -------------------------------------------------------------------------------- /src/ol/geom/flat/topology.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/geom/flat/topology 3 | */ 4 | import {linearRing as linearRingArea} from './area.js'; 5 | 6 | /** 7 | * Check if the linestring is a boundary. 8 | * @param {Array } flatCoordinates Flat coordinates. 9 | * @param {number} offset Offset. 10 | * @param {number} end End. 11 | * @param {number} stride Stride. 12 | * @return {boolean} The linestring is a boundary. 13 | */ 14 | export function lineStringIsClosed(flatCoordinates, offset, end, stride) { 15 | const lastCoord = end - stride; 16 | if (flatCoordinates[offset] === flatCoordinates[lastCoord] && 17 | flatCoordinates[offset + 1] === flatCoordinates[lastCoord + 1] && (end - offset) / stride > 3) { 18 | return !!linearRingArea(flatCoordinates, offset, end, stride); 19 | } 20 | return false; 21 | } 22 | -------------------------------------------------------------------------------- /docs/templates/jaguarjs/tmpl/exceptions.tmpl: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 |
22 | 23 |- 7 |
11 |8 | 9 |10 |- 12 |
13 |
20 | 21 |- 14 | Type 15 |
16 |- 17 | 18 |
19 |24 | 25 | 26 | 27 | 28 | 29 |30 | 31 | -------------------------------------------------------------------------------- /src/plot/plots/Curve.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | import Plot from './Plot' 4 | import PlotTypes from '../PlotTypes' 5 | import LineString from '../../ol/geom/LineString' 6 | import mix from '../../util/mixin' 7 | import * as PlotUtils from '../utils/plot_util' 8 | 9 | export default class Curve extends mix(Plot, LineString) { 10 | 11 | constructor(points) { 12 | super(points); 13 | this.type = PlotTypes.CURVE; 14 | this.t = 0.3; 15 | this.setPoints(points); 16 | } 17 | generate() { 18 | var count = this.getPointCount(); 19 | if (count < 2) { 20 | return; 21 | } 22 | if (count == 2) { 23 | this.setCoordinates(this.points); 24 | } else { 25 | this.setCoordinates(PlotUtils.getCurvePoints(this.t, this.points)); 26 | } 27 | 28 | 29 | } 30 | } -------------------------------------------------------------------------------- /src/ol/source/TileEventType.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/source/TileEventType 3 | */ 4 | 5 | /** 6 | * @enum {string} 7 | */ 8 | export default { 9 | 10 | /** 11 | * Triggered when a tile starts loading. 12 | * @event module:ol/source/Tile.TileSourceEvent#tileloadstart 13 | * @api 14 | */ 15 | TILELOADSTART: 'tileloadstart', 16 | 17 | /** 18 | * Triggered when a tile finishes loading, either when its data is loaded, 19 | * or when loading was aborted because the tile is no longer needed. 20 | * @event module:ol/source/Tile.TileSourceEvent#tileloadend 21 | * @api 22 | */ 23 | TILELOADEND: 'tileloadend', 24 | 25 | /** 26 | * Triggered if tile loading results in an error. 27 | * @event module:ol/source/Tile.TileSourceEvent#tileloaderror 28 | * @api 29 | */ 30 | TILELOADERROR: 'tileloaderror' 31 | 32 | }; 33 | -------------------------------------------------------------------------------- /src/plot/style/StyleFactory.js: -------------------------------------------------------------------------------- 1 | import MarkerStyle from './MarkerStyle' 2 | import PloylineStyle from './PloyLineStyle' 3 | import PloygonStyle from './PloygonStyle' 4 | 5 | import PlotTypes from './../PlotTypes' 6 | /** 7 | * @classdesc 样式工厂。根据图元类型生成样式对象 8 | * @author daiyujie 9 | */ 10 | class StyleFactory { 11 | /** 12 | * @param {PlotTypes} type 类型 13 | * @static 14 | */ 15 | static createFTStyle(type) { 16 | 17 | switch (type) { 18 | case PlotTypes.MARKER: 19 | return new MarkerStyle(); 20 | case PlotTypes.POLYLINE: 21 | return new PloylineStyle(); 22 | case PlotTypes.POLYGON: 23 | return new PloygonStyle(); 24 | } 25 | 26 | return new PloygonStyle(); 27 | } 28 | } 29 | 30 | export default StyleFactory -------------------------------------------------------------------------------- /src/ol.js: -------------------------------------------------------------------------------- 1 | export * from './ol/index'; 2 | import * as control from './ol/control'; 3 | import * as events from './ol/events'; 4 | import * as extent from './ol/extent'; 5 | import * as format from './ol/format'; 6 | import * as geom from './ol/geom'; 7 | import * as interaction from './ol/interaction'; 8 | import * as layer from './ol/layer'; 9 | import * as proj from './ol/proj'; 10 | import * as render from './ol/render'; 11 | import * as reproj from './ol/reproj'; 12 | import * as source from './ol/source'; 13 | import * as style from './ol/style'; 14 | import * as tilegrid from './ol/tilegrid'; 15 | import * as webgl from './ol/webgl'; 16 | export { 17 | control, 18 | events, 19 | extent, 20 | format, 21 | geom, 22 | interaction, 23 | layer, 24 | proj, 25 | render, 26 | reproj, 27 | source, 28 | style, 29 | tilegrid, 30 | webgl 31 | } 32 | -------------------------------------------------------------------------------- /src/util/array.js: -------------------------------------------------------------------------------- 1 | export function swap(arr, index1, index2) { 2 | 3 | if (index1 >= arr.length || index2 >= arr.length) 4 | return null; 5 | 6 | arr[index1] = arr.splice(index2, 1, arr[index1])[0]; 7 | return arr; 8 | } 9 | export function moveUp(arr, $index) { 10 | if ($index == arr.length - 1) { 11 | return; 12 | } 13 | swap(arr, $index, $index + 1); 14 | } 15 | 16 | export function moveDown(arr, $index) { 17 | if ($index == 0) { 18 | return; 19 | } 20 | swap(arr, $index, $index - 1); 21 | } 22 | export function moveToTop(arr, $index) { 23 | if ($index == arr.length - 1) { 24 | return; 25 | } 26 | swap(arr, $index, arr.length - 1); 27 | } 28 | export function moveToBottom(arr, $index) { 29 | if ($index == 0) { 30 | return; 31 | } 32 | swap(arr, $index, 0); 33 | } 34 | -------------------------------------------------------------------------------- /src/ol/proj/projections.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/proj/projections 3 | */ 4 | 5 | 6 | /** 7 | * @type {Object} 8 | */ 9 | let cache = {}; 10 | 11 | 12 | /** 13 | * Clear the projections cache. 14 | */ 15 | export function clear() { 16 | cache = {}; 17 | } 18 | 19 | 20 | /** 21 | * Get a cached projection by code. 22 | * @param {string} code The code for the projection. 23 | * @return {import("./Projection.js").default} The projection (if cached). 24 | */ 25 | export function get(code) { 26 | return cache[code] || null; 27 | } 28 | 29 | 30 | /** 31 | * Add a projection to the cache. 32 | * @param {string} code The projection code. 33 | * @param {import("./Projection.js").default} projection The projection to cache. 34 | */ 35 | export function add(code, projection) { 36 | cache[code] = projection; 37 | } 38 | -------------------------------------------------------------------------------- /src/plot/events/FeatureEvent.js: -------------------------------------------------------------------------------- 1 | import Event from '../../ol/events/Event' 2 | 3 | class FeatureEvent extends Event { 4 | 5 | /** 6 | * @classdesc 传递Feature的Event 7 | * 用来传递feature 8 | * @constructs 9 | * @extends {ol.Event} 10 | * @author daiyujie 11 | * @param {String} type 事件类型 12 | * @param {ol.Feature} feature 图元 13 | */ 14 | constructor(type, feature) { 15 | super(type); 16 | this.feature = feature; 17 | } 18 | } 19 | /** 20 | * 当图元被激活时触发 21 | * @static 22 | */ 23 | FeatureEvent.ACTIVATE = 'activate_feature'; 24 | /** 25 | * 当图元被取消激活时触发 26 | * @static 27 | */ 28 | FeatureEvent.DEACTIVATE = 'deactivate_feature'; 29 | /** 30 | * 当绘制结束时触发 31 | * @static 32 | */ 33 | FeatureEvent.DRAW_END = 'draw_end'; 34 | /** 35 | * 绘制开始时触发 36 | * @static 37 | */ 38 | FeatureEvent.DRAW_START = 'draw_start' 39 | 40 | export default FeatureEvent -------------------------------------------------------------------------------- /docs/document/scripts/prettify/lang-css.js: -------------------------------------------------------------------------------- 1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n"]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com", 2 | /^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]); 3 | -------------------------------------------------------------------------------- /docs/templates/jaguarjs/static/scripts/prettify/lang-css.js: -------------------------------------------------------------------------------- 1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n"]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com", 2 | /^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]); 3 | -------------------------------------------------------------------------------- /src/ol/geom/flat/center.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/geom/flat/center 3 | */ 4 | import {createEmpty, createOrUpdateFromFlatCoordinates} from '../../extent.js'; 5 | 6 | 7 | /** 8 | * @param {Array } flatCoordinates Flat coordinates. 9 | * @param {number} offset Offset. 10 | * @param {Array >} endss Endss. 11 | * @param {number} stride Stride. 12 | * @return {Array } Flat centers. 13 | */ 14 | export function linearRingss(flatCoordinates, offset, endss, stride) { 15 | const flatCenters = []; 16 | let extent = createEmpty(); 17 | for (let i = 0, ii = endss.length; i < ii; ++i) { 18 | const ends = endss[i]; 19 | extent = createOrUpdateFromFlatCoordinates(flatCoordinates, offset, ends[0], stride); 20 | flatCenters.push((extent[0] + extent[2]) / 2, (extent[1] + extent[3]) / 2); 21 | offset = ends[ends.length - 1]; 22 | } 23 | return flatCenters; 24 | } 25 | -------------------------------------------------------------------------------- /src/ol/format/filter/IsBetween.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/format/filter/IsBetween 3 | */ 4 | import Comparison from './Comparison.js'; 5 | 6 | /** 7 | * @classdesc 8 | * Represents a ` ` comparison operator. 9 | * @api 10 | */ 11 | class IsBetween extends Comparison { 12 | 13 | /** 14 | * @param {!string} propertyName Name of the context property to compare. 15 | * @param {!number} lowerBoundary The lower bound of the range. 16 | * @param {!number} upperBoundary The upper bound of the range. 17 | */ 18 | constructor(propertyName, lowerBoundary, upperBoundary) { 19 | super('PropertyIsBetween', propertyName); 20 | 21 | /** 22 | * @type {!number} 23 | */ 24 | this.lowerBoundary = lowerBoundary; 25 | 26 | /** 27 | * @type {!number} 28 | */ 29 | this.upperBoundary = upperBoundary; 30 | 31 | } 32 | } 33 | 34 | export default IsBetween; 35 | -------------------------------------------------------------------------------- /src/plot/style/Style.js: -------------------------------------------------------------------------------- 1 | import {deepcopy} from '../../util/core' 2 | class FTStyle { 3 | /** 4 | * @classdesc 样式基类对象 5 | * @author daiyujie 6 | * @constructs 7 | */ 8 | constructor() { 9 | this._style = {}; 10 | this.isDestoryed = false; 11 | } 12 | /** 13 | * 将json类型的样式,转换为ol.style 14 | * @return {ol.Style} 15 | */ 16 | parse() { 17 | return new Style(); 18 | } 19 | /** 20 | * 序列化样式 21 | * @return {JSON} 22 | */ 23 | serialize() { 24 | return deepcopy(this._style); 25 | } 26 | /** 27 | * 设置样式 28 | * @param {JSON} json_style 29 | */ 30 | setStyle(json_style) { 31 | this._style = json_style; 32 | } 33 | /** 34 | * 销毁对象 35 | */ 36 | destory() { 37 | this._style = {}; 38 | this.isDestoryed = true; 39 | } 40 | 41 | } 42 | export default FTStyle; -------------------------------------------------------------------------------- /src/ol/format/filter/LogicalNary.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/format/filter/LogicalNary 3 | */ 4 | import {assert} from '../../asserts.js'; 5 | import Filter from './Filter.js'; 6 | 7 | /** 8 | * @classdesc 9 | * Abstract class; normally only used for creating subclasses and not instantiated in apps. 10 | * Base class for WFS GetFeature n-ary logical filters. 11 | * 12 | * @abstract 13 | */ 14 | class LogicalNary extends Filter { 15 | 16 | /** 17 | * @param {!string} tagName The XML tag name for this filter. 18 | * @param {Array } conditions Conditions. 19 | */ 20 | constructor(tagName, conditions) { 21 | 22 | super(tagName); 23 | 24 | /** 25 | * @type {Array } 26 | */ 27 | this.conditions = conditions; 28 | assert(this.conditions.length >= 2, 57); // At least 2 conditions are required. 29 | } 30 | 31 | } 32 | 33 | export default LogicalNary; 34 | -------------------------------------------------------------------------------- /src/ol/colorlike.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/colorlike 3 | */ 4 | import {toString} from './color.js'; 5 | 6 | 7 | /** 8 | * A type accepted by CanvasRenderingContext2D.fillStyle 9 | * or CanvasRenderingContext2D.strokeStyle. 10 | * Represents a color, pattern, or gradient. The origin for patterns and 11 | * gradients as fill style is an increment of 512 css pixels from map coordinate 12 | * `[0, 0]`. For seamless repeat patterns, width and height of the pattern image 13 | * must be a factor of two (2, 4, 8, ..., 512). 14 | * 15 | * @typedef {string|CanvasPattern|CanvasGradient} ColorLike 16 | * @api 17 | */ 18 | 19 | 20 | /** 21 | * @param {import("./color.js").Color|ColorLike} color Color. 22 | * @return {ColorLike} The color as an {@link ol/colorlike~ColorLike}. 23 | * @api 24 | */ 25 | export function asColorLike(color) { 26 | if (Array.isArray(color)) { 27 | return toString(color); 28 | } else { 29 | return color; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/plot/style/PloyLineStyle.js: -------------------------------------------------------------------------------- 1 | import FTStyle from "./Style"; 2 | import Style from '../../ol/style/Style' 3 | import Stroke from '../../ol/style/Stroke' 4 | import Fill from '../../ol/style/Fill' 5 | 6 | class PolyLineStyle extends FTStyle { 7 | 8 | /** 9 | * @classdesc 折线类样式 10 | * @author daiyujie 11 | * @extends {FTStyle} 12 | * @constructs 13 | */ 14 | constructor() { 15 | super(); 16 | this._style = { 17 | //--ol.style.Stroke所有选项 18 | stroke: { 19 | color: '#FF0000', 20 | width: 3, 21 | lineDash: [10, 10, 10] 22 | } 23 | } 24 | } 25 | parse() { 26 | let stroke = null; 27 | if (this._style.stroke) { 28 | stroke = new Stroke(this._style.stroke) 29 | } 30 | return new Style({ 31 | stroke: stroke 32 | }); 33 | } 34 | } 35 | 36 | export default PolyLineStyle -------------------------------------------------------------------------------- /src/ol/MapBrowserPointerEvent.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/MapBrowserPointerEvent 3 | */ 4 | import MapBrowserEvent from './MapBrowserEvent.js'; 5 | 6 | class MapBrowserPointerEvent extends MapBrowserEvent { 7 | 8 | /** 9 | * @param {string} type Event type. 10 | * @param {import("./PluggableMap.js").default} map Map. 11 | * @param {import("./pointer/PointerEvent.js").default} pointerEvent Pointer event. 12 | * @param {boolean=} opt_dragging Is the map currently being dragged? 13 | * @param {?import("./PluggableMap.js").FrameState=} opt_frameState Frame state. 14 | */ 15 | constructor(type, map, pointerEvent, opt_dragging, opt_frameState) { 16 | 17 | super(type, map, pointerEvent.originalEvent, opt_dragging, opt_frameState); 18 | 19 | /** 20 | * @const 21 | * @type {import("./pointer/PointerEvent.js").default} 22 | */ 23 | this.pointerEvent = pointerEvent; 24 | 25 | } 26 | 27 | } 28 | 29 | export default MapBrowserPointerEvent; 30 | -------------------------------------------------------------------------------- /src/ol/uri.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/uri 3 | */ 4 | 5 | 6 | /** 7 | * Appends query parameters to a URI. 8 | * 9 | * @param {string} uri The original URI, which may already have query data. 10 | * @param {!Object} params An object where keys are URI-encoded parameter keys, 11 | * and the values are arbitrary types or arrays. 12 | * @return {string} The new URI. 13 | */ 14 | export function appendParams(uri, params) { 15 | const keyParams = []; 16 | // Skip any null or undefined parameter values 17 | Object.keys(params).forEach(function(k) { 18 | if (params[k] !== null && params[k] !== undefined) { 19 | keyParams.push(k + '=' + encodeURIComponent(params[k])); 20 | } 21 | }); 22 | const qs = keyParams.join('&'); 23 | // remove any trailing ? or & 24 | uri = uri.replace(/[?&]$/, ''); 25 | // append ? or & depending on whether uri has existing parameters 26 | uri = uri.indexOf('?') === -1 ? uri + '?' : uri + '&'; 27 | return uri + qs; 28 | } 29 | -------------------------------------------------------------------------------- /src/ol/render/canvas/Instruction.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/render/canvas/Instruction 3 | */ 4 | 5 | /** 6 | * @enum {number} 7 | */ 8 | const Instruction = { 9 | BEGIN_GEOMETRY: 0, 10 | BEGIN_PATH: 1, 11 | CIRCLE: 2, 12 | CLOSE_PATH: 3, 13 | CUSTOM: 4, 14 | DRAW_CHARS: 5, 15 | DRAW_IMAGE: 6, 16 | END_GEOMETRY: 7, 17 | FILL: 8, 18 | MOVE_TO_LINE_TO: 9, 19 | SET_FILL_STYLE: 10, 20 | SET_STROKE_STYLE: 11, 21 | STROKE: 12 22 | }; 23 | 24 | 25 | /** 26 | * @type {Array } 27 | */ 28 | export const fillInstruction = [Instruction.FILL]; 29 | 30 | 31 | /** 32 | * @type {Array } 33 | */ 34 | export const strokeInstruction = [Instruction.STROKE]; 35 | 36 | 37 | /** 38 | * @type {Array } 39 | */ 40 | export const beginPathInstruction = [Instruction.BEGIN_PATH]; 41 | 42 | 43 | /** 44 | * @type {Array } 45 | */ 46 | export const closePathInstruction = [Instruction.CLOSE_PATH]; 47 | 48 | 49 | export default Instruction; 50 | -------------------------------------------------------------------------------- /src/ol/util.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/util 3 | */ 4 | 5 | /** 6 | * @return {?} Any return. 7 | */ 8 | export function abstract() { 9 | return /** @type {?} */ ((function() { 10 | throw new Error('Unimplemented abstract method.'); 11 | })()); 12 | } 13 | 14 | /** 15 | * Counter for getUid. 16 | * @type {number} 17 | * @private 18 | */ 19 | let uidCounter_ = 0; 20 | 21 | /** 22 | * Gets a unique ID for an object. This mutates the object so that further calls 23 | * with the same object as a parameter returns the same value. Unique IDs are generated 24 | * as a strictly increasing sequence. Adapted from goog.getUid. 25 | * 26 | * @param {Object} obj The object to get the unique ID for. 27 | * @return {string} The unique ID for the object. 28 | * @api 29 | */ 30 | export function getUid(obj) { 31 | return obj.ol_uid || (obj.ol_uid = String(++uidCounter_)); 32 | } 33 | 34 | /** 35 | * OpenLayers version. 36 | * @type {string} 37 | */ 38 | export const VERSION = 'latest'; 39 | -------------------------------------------------------------------------------- /src/ol/format.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/format 3 | */ 4 | 5 | export {default as EsriJSON} from './format/EsriJSON.js'; 6 | export {default as GeoJSON} from './format/GeoJSON.js'; 7 | export {default as GML} from './format/GML.js'; 8 | export {default as GPX} from './format/GPX.js'; 9 | export {default as IGC} from './format/IGC.js'; 10 | export {default as IIIFInfo} from './format/IIIFInfo.js'; 11 | export {default as KML} from './format/KML.js'; 12 | export {default as MVT} from './format/MVT.js'; 13 | export {default as OWS} from './format/OWS.js'; 14 | export {default as Polyline} from './format/Polyline.js'; 15 | export {default as TopoJSON} from './format/TopoJSON.js'; 16 | export {default as WFS} from './format/WFS.js'; 17 | export {default as WKT} from './format/WKT.js'; 18 | export {default as WMSCapabilities} from './format/WMSCapabilities.js'; 19 | export {default as WMSGetFeatureInfo} from './format/WMSGetFeatureInfo.js'; 20 | export {default as WMTSCapabilities} from './format/WMTSCapabilities.js'; 21 | -------------------------------------------------------------------------------- /docs/document/scripts/linenumber.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var counter = 0; 3 | var numbered; 4 | var source = document.getElementsByClassName('prettyprint source'); 5 | 6 | if (source && source[0]) { 7 | var linenums = config.linenums; 8 | 9 | if (linenums) { 10 | source = source[0].getElementsByTagName('ol')[0]; 11 | 12 | numbered = Array.prototype.slice.apply(source.children); 13 | numbered = numbered.map(function(item) { 14 | counter++; 15 | item.id = 'line' + counter; 16 | }); 17 | } else { 18 | source = source[0].getElementsByTagName('code')[0]; 19 | 20 | numbered = source.innerHTML.split('\n'); 21 | numbered = numbered.map(function(item) { 22 | counter++; 23 | return '' + item; 24 | }); 25 | 26 | source.innerHTML = numbered.join('\n'); 27 | } 28 | } 29 | })(); 30 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "plot-ol", 3 | "version": "1.0.0", 4 | "description": "Example using OpenLayers with Rollup", 5 | "scripts": { 6 | "start": "rollup --config rollup.config.normal.js --watch", 7 | "start-ie": "rollup --config rollup.config.ie.js --watch", 8 | "build": "rollup --config rollup.config.normal.js", 9 | "build-ie": "rollup --config rollup.config.ie.js", 10 | "docs": "node_modules/.bin/jsdoc --configure jsdoc.json --verbose" 11 | }, 12 | "devDependencies": { 13 | "@babel/core": "^7.6.2", 14 | "@babel/preset-env": "^7.6.2", 15 | "jsdoc": "^3.6.3", 16 | "rollup": "^1.21.4", 17 | "rollup-plugin-babel": "^4.3.3", 18 | "rollup-plugin-commonjs": "^8.0.2", 19 | "rollup-plugin-json": "^2.3.0", 20 | "rollup-plugin-node-resolve": "^3.0.0", 21 | "rollup-plugin-terser": "^1.0.1" 22 | }, 23 | "author": "daiyujie 576981389@qq.com", 24 | "license":"MIT", 25 | "dependencies": { 26 | "@babel/polyfill": "^7.6.0", 27 | "ol": "^5.1.2" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /docs/templates/jaguarjs/static/scripts/linenumber.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var counter = 0; 3 | var numbered; 4 | var source = document.getElementsByClassName('prettyprint source'); 5 | 6 | if (source && source[0]) { 7 | var linenums = config.linenums; 8 | 9 | if (linenums) { 10 | source = source[0].getElementsByTagName('ol')[0]; 11 | 12 | numbered = Array.prototype.slice.apply(source.children); 13 | numbered = numbered.map(function(item) { 14 | counter++; 15 | item.id = 'line' + counter; 16 | }); 17 | } else { 18 | source = source[0].getElementsByTagName('code')[0]; 19 | 20 | numbered = source.innerHTML.split('\n'); 21 | numbered = numbered.map(function(item) { 22 | counter++; 23 | return '' + item; 24 | }); 25 | 26 | source.innerHTML = numbered.join('\n'); 27 | } 28 | } 29 | })(); 30 | -------------------------------------------------------------------------------- /src/ol/source/VectorEventType.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/source/VectorEventType 3 | */ 4 | 5 | /** 6 | * @enum {string} 7 | */ 8 | export default { 9 | /** 10 | * Triggered when a feature is added to the source. 11 | * @event module:ol/source/Vector.VectorSourceEvent#addfeature 12 | * @api 13 | */ 14 | ADDFEATURE: 'addfeature', 15 | 16 | /** 17 | * Triggered when a feature is updated. 18 | * @event module:ol/source/Vector.VectorSourceEvent#changefeature 19 | * @api 20 | */ 21 | CHANGEFEATURE: 'changefeature', 22 | 23 | /** 24 | * Triggered when the clear method is called on the source. 25 | * @event module:ol/source/Vector.VectorSourceEvent#clear 26 | * @api 27 | */ 28 | CLEAR: 'clear', 29 | 30 | /** 31 | * Triggered when a feature is removed from the source. 32 | * See {@link module:ol/source/Vector#clear source.clear()} for exceptions. 33 | * @event module:ol/source/Vector.VectorSourceEvent#removefeature 34 | * @api 35 | */ 36 | REMOVEFEATURE: 'removefeature' 37 | }; 38 | -------------------------------------------------------------------------------- /src/plot/style/PloygonStyle.js: -------------------------------------------------------------------------------- 1 | import FTStyle from "./Style"; 2 | import Style from '../../ol/style/Style' 3 | import Stroke from '../../ol/style/Stroke' 4 | import Fill from '../../ol/style/Fill' 5 | class PolygonStyle extends FTStyle { 6 | /** 7 | * @classdesc 多边形类样式 8 | * @author daiyujie 9 | * @extends {FTStyle} 10 | * @constructs 11 | */ 12 | constructor() { 13 | super(); 14 | this._style = { 15 | fill: { color: 'rgba(0,255,0,0.4)' }, 16 | stroke: { 17 | color: '#FF0000', 18 | width: 2 19 | } 20 | } 21 | } 22 | parse() { 23 | let fill, stroke = null; 24 | if (this._style.fill) { 25 | fill = new Fill(this._style.fill) 26 | } 27 | if (this._style.stroke) { 28 | stroke = new Stroke(this._style.stroke) 29 | } 30 | return new Style({ 31 | fill: fill, 32 | stroke: stroke 33 | }); 34 | } 35 | 36 | 37 | } 38 | export default PolygonStyle -------------------------------------------------------------------------------- /src/ol/format/filter/Bbox.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/format/filter/Bbox 3 | */ 4 | import Filter from './Filter.js'; 5 | 6 | /** 7 | * @classdesc 8 | * Represents a ` ` operator to test whether a geometry-valued property 9 | * intersects a fixed bounding box 10 | * 11 | * @api 12 | */ 13 | class Bbox extends Filter { 14 | 15 | /** 16 | * @param {!string} geometryName Geometry name to use. 17 | * @param {!import("../../extent.js").Extent} extent Extent. 18 | * @param {string=} opt_srsName SRS name. No srsName attribute will be set 19 | * on geometries when this is not provided. 20 | */ 21 | constructor(geometryName, extent, opt_srsName) { 22 | 23 | super('BBOX'); 24 | 25 | /** 26 | * @type {!string} 27 | */ 28 | this.geometryName = geometryName; 29 | 30 | /** 31 | * @type {import("../../extent.js").Extent} 32 | */ 33 | this.extent = extent; 34 | 35 | /** 36 | * @type {string|undefined} 37 | */ 38 | this.srsName = opt_srsName; 39 | } 40 | 41 | } 42 | 43 | export default Bbox; 44 | -------------------------------------------------------------------------------- /src/ol/geom/flat/flip.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/geom/flat/flip 3 | */ 4 | 5 | 6 | /** 7 | * @param {Array } flatCoordinates Flat coordinates. 8 | * @param {number} offset Offset. 9 | * @param {number} end End. 10 | * @param {number} stride Stride. 11 | * @param {Array =} opt_dest Destination. 12 | * @param {number=} opt_destOffset Destination offset. 13 | * @return {Array } Flat coordinates. 14 | */ 15 | export function flipXY(flatCoordinates, offset, end, stride, opt_dest, opt_destOffset) { 16 | let dest, destOffset; 17 | if (opt_dest !== undefined) { 18 | dest = opt_dest; 19 | destOffset = opt_destOffset !== undefined ? opt_destOffset : 0; 20 | } else { 21 | dest = []; 22 | destOffset = 0; 23 | } 24 | let j = offset; 25 | while (j < end) { 26 | const x = flatCoordinates[j++]; 27 | dest[destOffset++] = flatCoordinates[j++]; 28 | dest[destOffset++] = x; 29 | for (let k = 2; k < stride; ++k) { 30 | dest[destOffset++] = flatCoordinates[j++]; 31 | } 32 | } 33 | dest.length = destOffset; 34 | return dest; 35 | } 36 | -------------------------------------------------------------------------------- /src/ol/MapEvent.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/MapEvent 3 | */ 4 | import Event from './events/Event.js'; 5 | 6 | /** 7 | * @classdesc 8 | * Events emitted as map events are instances of this type. 9 | * See {@link module:ol/PluggableMap~PluggableMap} for which events trigger a map event. 10 | */ 11 | class MapEvent extends Event { 12 | 13 | /** 14 | * @param {string} type Event type. 15 | * @param {import("./PluggableMap.js").default} map Map. 16 | * @param {?import("./PluggableMap.js").FrameState=} opt_frameState Frame state. 17 | */ 18 | constructor(type, map, opt_frameState) { 19 | 20 | super(type); 21 | 22 | /** 23 | * The map where the event occurred. 24 | * @type {import("./PluggableMap.js").default} 25 | * @api 26 | */ 27 | this.map = map; 28 | 29 | /** 30 | * The frame state at the time of the event. 31 | * @type {?import("./PluggableMap.js").FrameState} 32 | * @api 33 | */ 34 | this.frameState = opt_frameState !== undefined ? opt_frameState : null; 35 | 36 | } 37 | 38 | } 39 | 40 | export default MapEvent; 41 | -------------------------------------------------------------------------------- /src/ol/format/filter/ComparisonBinary.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/format/filter/ComparisonBinary 3 | */ 4 | import Comparison from './Comparison.js'; 5 | 6 | /** 7 | * @classdesc 8 | * Abstract class; normally only used for creating subclasses and not instantiated in apps. 9 | * Base class for WFS GetFeature property binary comparison filters. 10 | * 11 | * @abstract 12 | */ 13 | class ComparisonBinary extends Comparison { 14 | 15 | /** 16 | * @param {!string} tagName The XML tag name for this filter. 17 | * @param {!string} propertyName Name of the context property to compare. 18 | * @param {!(string|number)} expression The value to compare. 19 | * @param {boolean=} opt_matchCase Case-sensitive? 20 | */ 21 | constructor(tagName, propertyName, expression, opt_matchCase) { 22 | 23 | super(tagName, propertyName); 24 | 25 | /** 26 | * @type {!(string|number)} 27 | */ 28 | this.expression = expression; 29 | 30 | /** 31 | * @type {boolean|undefined} 32 | */ 33 | this.matchCase = opt_matchCase; 34 | } 35 | 36 | } 37 | 38 | export default ComparisonBinary; 39 | -------------------------------------------------------------------------------- /src/ol/events/EventType.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/events/EventType 3 | */ 4 | 5 | /** 6 | * @enum {string} 7 | * @const 8 | */ 9 | export default { 10 | /** 11 | * Generic change event. Triggered when the revision counter is increased. 12 | * @event module:ol/events/Event~Event#change 13 | * @api 14 | */ 15 | CHANGE: 'change', 16 | 17 | /** 18 | * Generic error event. Triggered when an error occurs. 19 | * @event module:ol/events/Event~Event#error 20 | * @api 21 | */ 22 | ERROR: 'error', 23 | 24 | CLEAR: 'clear', 25 | CONTEXTMENU: 'contextmenu', 26 | CLICK: 'click', 27 | DBLCLICK: 'dblclick', 28 | DRAGENTER: 'dragenter', 29 | DRAGOVER: 'dragover', 30 | DROP: 'drop', 31 | KEYDOWN: 'keydown', 32 | KEYPRESS: 'keypress', 33 | LOAD: 'load', 34 | MOUSEDOWN: 'mousedown', 35 | MOUSEMOVE: 'mousemove', 36 | MOUSEOUT: 'mouseout', 37 | MOUSEUP: 'mouseup', 38 | MOUSEWHEEL: 'mousewheel', 39 | MSPOINTERDOWN: 'MSPointerDown', 40 | RESIZE: 'resize', 41 | TOUCHSTART: 'touchstart', 42 | TOUCHMOVE: 'touchmove', 43 | TOUCHEND: 'touchend', 44 | WHEEL: 'wheel' 45 | }; 46 | -------------------------------------------------------------------------------- /docs/templates/jaguarjs/tmpl/members.tmpl: -------------------------------------------------------------------------------- 1 | ' + self.linkto(name, self.htmlsafe(name)) + ' '; 9 | }); 10 | } 11 | ?> 12 | 13 | 21 |14 | 15 |16 | 17 | 18 | 19 | 20 |22 | 23 | 35 | -------------------------------------------------------------------------------- /src/plot/plots/Rectangle.js: -------------------------------------------------------------------------------- 1 | import Plot from './Plot' 2 | import PlotTypes from '../PlotTypes' 3 | import PolygonOL from '../../ol/geom/Polygon' 4 | import mix from '../../util/mixin' 5 | export default class Rectangle extends mix(Plot, PolygonOL) { 6 | 7 | constructor(points) { 8 | super(points); 9 | this.type = PlotTypes.RECTANGLE; 10 | this.fixPointCount = 2; 11 | this.setPoints(points); 12 | } 13 | generate() { 14 | var count = this.getPointCount(); 15 | if (count < 2) { 16 | return; 17 | } else { 18 | var pnt1 = this.points[0]; 19 | var pnt2 = this.points[1]; 20 | var xmin = Math.min(pnt1[0], pnt2[0]); 21 | var xmax = Math.max(pnt1[0], pnt2[0]); 22 | var ymin = Math.min(pnt1[1], pnt2[1]); 23 | var ymax = Math.max(pnt1[1], pnt2[1]); 24 | var tl = [xmin, ymax]; 25 | var tr = [xmax, ymax]; 26 | var br = [xmax, ymin]; 27 | var bl = [xmin, ymin]; 28 | this.setCoordinates([[tl, tr, br, bl]]); 29 | } 30 | } 31 | 32 | 33 | } -------------------------------------------------------------------------------- /src/ol/layer/Vector.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/layer/Vector 3 | */ 4 | import BaseVectorLayer from './BaseVector.js'; 5 | import CanvasVectorLayerRenderer from '../renderer/canvas/VectorLayer.js'; 6 | 7 | 8 | /** 9 | * @classdesc 10 | * Vector data that is rendered client-side. 11 | * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject} 12 | * property on the layer object; for example, setting `title: 'My Title'` in the 13 | * options means that `title` is observable, and has get/set accessors. 14 | * 15 | * @extends {BaseVectorLayer24 | 25 |26 | 27 | 28 | 29 | 30 | 31 |Example 1? 's':'' ?>
32 | 33 | 34 |} 16 | * @api 17 | */ 18 | class VectorLayer extends BaseVectorLayer { 19 | /** 20 | * @param {import("./BaseVector.js").Options=} opt_options Options. 21 | */ 22 | constructor(opt_options) { 23 | super(opt_options); 24 | } 25 | 26 | /** 27 | * Create a renderer for this layer. 28 | * @return {import("../renderer/Layer.js").default} A layer renderer. 29 | * @protected 30 | */ 31 | createRenderer() { 32 | return new CanvasVectorLayerRenderer(this); 33 | } 34 | } 35 | 36 | 37 | export default VectorLayer; 38 | -------------------------------------------------------------------------------- /src/ol/format/GML.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/format/GML 3 | */ 4 | import GML3 from './GML3.js'; 5 | 6 | /** 7 | * @classdesc 8 | * Feature format for reading and writing data in the GML format 9 | * version 3.1.1. 10 | * Currently only supports GML 3.1.1 Simple Features profile. 11 | * 12 | * @param {import("./GMLBase.js").Options=} opt_options 13 | * Optional configuration object. 14 | * @api 15 | */ 16 | const GML = GML3; 17 | 18 | 19 | /** 20 | * Encode an array of features in GML 3.1.1 Simple Features. 21 | * 22 | * @function 23 | * @param {Array } features Features. 24 | * @param {import("./Feature.js").WriteOptions=} opt_options Options. 25 | * @return {string} Result. 26 | * @api 27 | */ 28 | GML.prototype.writeFeatures; 29 | 30 | 31 | /** 32 | * Encode an array of features in the GML 3.1.1 format as an XML node. 33 | * 34 | * @function 35 | * @param {Array } features Features. 36 | * @param {import("./Feature.js").WriteOptions=} opt_options Options. 37 | * @return {Node} Node. 38 | * @api 39 | */ 40 | GML.prototype.writeFeaturesNode; 41 | 42 | export default GML; 43 | -------------------------------------------------------------------------------- /src/ol/layer/Tile.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/layer/Tile 3 | */ 4 | import BaseTileLayer from './BaseTile.js'; 5 | import CanvasTileLayerRenderer from '../renderer/canvas/TileLayer.js'; 6 | 7 | 8 | /** 9 | * @classdesc 10 | * For layer sources that provide pre-rendered, tiled images in grids that are 11 | * organized by zoom levels for specific resolutions. 12 | * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject} 13 | * property on the layer object; for example, setting `title: 'My Title'` in the 14 | * options means that `title` is observable, and has get/set accessors. 15 | * 16 | * @api 17 | */ 18 | class TileLayer extends BaseTileLayer { 19 | 20 | /** 21 | * @param {import("./BaseTile.js").Options=} opt_options Tile layer options. 22 | */ 23 | constructor(opt_options) { 24 | super(opt_options); 25 | } 26 | 27 | /** 28 | * Create a renderer for this layer. 29 | * @return {import("../renderer/Layer.js").default} A layer renderer. 30 | * @protected 31 | */ 32 | createRenderer() { 33 | return new CanvasTileLayerRenderer(this); 34 | } 35 | 36 | } 37 | 38 | export default TileLayer; 39 | -------------------------------------------------------------------------------- /src/ol/pointer/EventSource.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/pointer/EventSource 3 | */ 4 | 5 | class EventSource { 6 | 7 | /** 8 | * @param {import("./PointerEventHandler.js").default} dispatcher Event handler. 9 | * @param {!Object } mapping Event mapping. 10 | */ 11 | constructor(dispatcher, mapping) { 12 | 13 | /** 14 | * @type {import("./PointerEventHandler.js").default} 15 | */ 16 | this.dispatcher = dispatcher; 17 | 18 | /** 19 | * @private 20 | * @const 21 | * @type {!Object } 22 | */ 23 | this.mapping_ = mapping; 24 | } 25 | 26 | /** 27 | * List of events supported by this source. 28 | * @return {Array } Event names 29 | */ 30 | getEvents() { 31 | return Object.keys(this.mapping_); 32 | } 33 | 34 | /** 35 | * Returns the handler that should handle a given event type. 36 | * @param {string} eventType The event type. 37 | * @return {function(Event)} Handler 38 | */ 39 | getHandlerForEvent(eventType) { 40 | return this.mapping_[eventType]; 41 | } 42 | 43 | } 44 | 45 | export default EventSource; 46 | -------------------------------------------------------------------------------- /docs/templates/jaguarjs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jaguarjs-jsdoc", 3 | "version": "0.0.1", 4 | "description": "Jaguar.js template for JSDoc 3", 5 | "main": "Gruntfile.js", 6 | "dependencies": { 7 | "taffydb": "^2.7.2", 8 | "underscore": "^1.7.0" 9 | }, 10 | "devDependencies": { 11 | "connect-livereload": "~0.3.2", 12 | "grunt": "~0.4.2", 13 | "grunt-contrib-clean": "~0.5.0", 14 | "grunt-contrib-copy": "~0.5.0", 15 | "grunt-contrib-less": "~0.9.0", 16 | "grunt-contrib-uglify": "~0.2.7", 17 | "grunt-contrib-watch": "~0.5.3", 18 | "grunt-jsdoc": "~0.5.1", 19 | "grunt-contrib-connect": "~0.6.0" 20 | }, 21 | "scripts": { 22 | "test": "echo \"Error: no test specified\" && exit 1" 23 | }, 24 | "repository": { 25 | "type": "git", 26 | "url": "git://github.com/davidshimjs/jaguarjs-jsdoc.git" 27 | }, 28 | "keywords": [ 29 | "jsdoc", 30 | "jsdoc3", 31 | "jaguar.js", 32 | "template" 33 | ], 34 | "author": "davidshimjs", 35 | "license": "MIT", 36 | "readmeFilename": "README.md", 37 | "bugs": { 38 | "url": "https://github.com/davidshimjs/jaguarjs-jsdoc/issues" 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /docs/templates/jaguarjs/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Sangmin, Shim 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /src/ol/layer/Image.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/layer/Image 3 | */ 4 | import BaseImageLayer from './BaseImage.js'; 5 | import CanvasImageLayerRenderer from '../renderer/canvas/ImageLayer.js'; 6 | 7 | 8 | /** 9 | * @typedef {import("./BaseImage.js").Options} Options 10 | */ 11 | 12 | 13 | /** 14 | * @classdesc 15 | * Server-rendered images that are available for arbitrary extents and 16 | * resolutions. 17 | * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject} 18 | * property on the layer object; for example, setting `title: 'My Title'` in the 19 | * options means that `title` is observable, and has get/set accessors. 20 | * 21 | * @api 22 | */ 23 | class ImageLayer extends BaseImageLayer { 24 | 25 | /** 26 | * @param {Options=} opt_options Layer options. 27 | */ 28 | constructor(opt_options) { 29 | super(opt_options); 30 | } 31 | 32 | /** 33 | * Create a renderer for this layer. 34 | * @return {import("../renderer/Layer.js").default} A layer renderer. 35 | * @protected 36 | */ 37 | createRenderer() { 38 | return new CanvasImageLayerRenderer(this); 39 | } 40 | 41 | } 42 | 43 | export default ImageLayer; 44 | -------------------------------------------------------------------------------- /src/ol/render/EventType.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/render/EventType 3 | */ 4 | 5 | /** 6 | * @enum {string} 7 | */ 8 | export default { 9 | 10 | /** 11 | * Triggered before a layer is rendered. 12 | * @event module:ol/render/Event~RenderEvent#prerender 13 | * @api 14 | */ 15 | PRERENDER: 'prerender', 16 | 17 | /** 18 | * Triggered after a layer is rendered. 19 | * @event module:ol/render/Event~RenderEvent#postrender 20 | * @api 21 | */ 22 | POSTRENDER: 'postrender', 23 | 24 | /** 25 | * Triggered before layers are rendered. 26 | * @event module:ol/render/Event~RenderEvent#precompose 27 | * @api 28 | */ 29 | PRECOMPOSE: 'precompose', 30 | 31 | /** 32 | * Triggered after all layers are rendered. 33 | * @event module:ol/render/Event~RenderEvent#postcompose 34 | * @api 35 | */ 36 | POSTCOMPOSE: 'postcompose', 37 | 38 | /** 39 | * Triggered when rendering is complete, i.e. all sources and tiles have 40 | * finished loading for the current viewport, and all tiles are faded in. 41 | * @event module:ol/render/Event~RenderEvent#rendercomplete 42 | * @api 43 | */ 44 | RENDERCOMPLETE: 'rendercomplete' 45 | 46 | }; 47 | -------------------------------------------------------------------------------- /src/ol/format/XML.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/format/XML 3 | */ 4 | import {isDocument, parse} from '../xml.js'; 5 | 6 | /** 7 | * @classdesc 8 | * Generic format for reading non-feature XML data 9 | * 10 | * @abstract 11 | */ 12 | class XML { 13 | /** 14 | * Read the source document. 15 | * 16 | * @param {Document|Element|string} source The XML source. 17 | * @return {Object} An object representing the source. 18 | * @api 19 | */ 20 | read(source) { 21 | if (!source) { 22 | return null; 23 | } else if (typeof source === 'string') { 24 | const doc = parse(source); 25 | return this.readFromDocument(doc); 26 | } else if (isDocument(source)) { 27 | return this.readFromDocument(/** @type {Document} */ (source)); 28 | } else { 29 | return this.readFromNode(/** @type {Element} */ (source)); 30 | } 31 | } 32 | 33 | /** 34 | * @abstract 35 | * @param {Document} doc Document. 36 | * @return {Object} Object 37 | */ 38 | readFromDocument(doc) {} 39 | 40 | /** 41 | * @abstract 42 | * @param {Element} node Node. 43 | * @return {Object} Object 44 | */ 45 | readFromNode(node) {} 46 | } 47 | 48 | export default XML; 49 | -------------------------------------------------------------------------------- /src/ol/geom/flat/segments.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/geom/flat/segments 3 | */ 4 | 5 | 6 | /** 7 | * This function calls `callback` for each segment of the flat coordinates 8 | * array. If the callback returns a truthy value the function returns that 9 | * value immediately. Otherwise the function returns `false`. 10 | * @param {Array } flatCoordinates Flat coordinates. 11 | * @param {number} offset Offset. 12 | * @param {number} end End. 13 | * @param {number} stride Stride. 14 | * @param {function(import("../../coordinate.js").Coordinate, import("../../coordinate.js").Coordinate): T} callback Function 15 | * called for each segment. 16 | * @return {T|boolean} Value. 17 | * @template T 18 | */ 19 | export function forEach(flatCoordinates, offset, end, stride, callback) { 20 | const point1 = [flatCoordinates[offset], flatCoordinates[offset + 1]]; 21 | const point2 = []; 22 | let ret; 23 | for (; (offset + stride) < end; offset += stride) { 24 | point2[0] = flatCoordinates[offset + stride]; 25 | point2[1] = flatCoordinates[offset + stride + 1]; 26 | ret = callback(point1, point2); 27 | if (ret) { 28 | return ret; 29 | } 30 | point1[0] = point2[0]; 31 | point1[1] = point2[1]; 32 | } 33 | return false; 34 | } 35 | -------------------------------------------------------------------------------- /src/ol/format/filter/Spatial.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/format/filter/Spatial 3 | */ 4 | import Filter from './Filter.js'; 5 | 6 | /** 7 | * @classdesc 8 | * Abstract class; normally only used for creating subclasses and not instantiated in apps. 9 | * Represents a spatial operator to test whether a geometry-valued property 10 | * relates to a given geometry. 11 | * 12 | * @abstract 13 | */ 14 | class Spatial extends Filter { 15 | 16 | /** 17 | * @param {!string} tagName The XML tag name for this filter. 18 | * @param {!string} geometryName Geometry name to use. 19 | * @param {!import("../../geom/Geometry.js").default} geometry Geometry. 20 | * @param {string=} opt_srsName SRS name. No srsName attribute will be 21 | * set on geometries when this is not provided. 22 | */ 23 | constructor(tagName, geometryName, geometry, opt_srsName) { 24 | 25 | super(tagName); 26 | 27 | /** 28 | * @type {!string} 29 | */ 30 | this.geometryName = geometryName || 'the_geom'; 31 | 32 | /** 33 | * @type {import("../../geom/Geometry.js").default} 34 | */ 35 | this.geometry = geometry; 36 | 37 | /** 38 | * @type {string|undefined} 39 | */ 40 | this.srsName = opt_srsName; 41 | } 42 | 43 | } 44 | 45 | export default Spatial; 46 | -------------------------------------------------------------------------------- /src/plot/plots/Sector.js: -------------------------------------------------------------------------------- 1 | import Plot from './Plot' 2 | import PlotTypes from '../PlotTypes' 3 | import PolygonOL from '../../ol/geom/Polygon' 4 | import mix from '../../util/mixin' 5 | import * as PlotUtils from '../utils/plot_util' 6 | // import Constants from '../constants' 7 | export default class Sector extends mix(Plot, PolygonOL) { 8 | 9 | constructor(points) { 10 | super(points); 11 | this.type = PlotTypes.SECTOR; 12 | this.fixPointCount = 3; 13 | this.setPoints(points); 14 | } 15 | generate() { 16 | if (this.getPointCount() < 2) 17 | return; 18 | if (this.getPointCount() == 2) 19 | this.setCoordinates([this.points]); 20 | else { 21 | var pnts = this.getPoints(); 22 | var center = pnts[0]; 23 | var pnt2 = pnts[1]; 24 | var pnt3 = pnts[2]; 25 | var radius = PlotUtils.distance(pnt2, center); 26 | var startAngle = PlotUtils.getAzimuth(pnt2, center); 27 | var endAngle = PlotUtils.getAzimuth(pnt3, center); 28 | var pList = PlotUtils.getArcPoints(center, radius, startAngle, endAngle); 29 | pList.push(center, pList[0]); 30 | this.setCoordinates([pList]); 31 | } 32 | 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /src/ol/TileCache.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/TileCache 3 | */ 4 | import LRUCache from './structs/LRUCache.js'; 5 | import {fromKey, getKey} from './tilecoord.js'; 6 | 7 | class TileCache extends LRUCache { 8 | 9 | /** 10 | * @param {number=} opt_highWaterMark High water mark. 11 | */ 12 | constructor(opt_highWaterMark) { 13 | 14 | super(opt_highWaterMark); 15 | 16 | } 17 | 18 | /** 19 | * @param {!Object } usedTiles Used tiles. 20 | */ 21 | expireCache(usedTiles) { 22 | while (this.canExpireCache()) { 23 | const tile = this.peekLast(); 24 | if (tile.getKey() in usedTiles) { 25 | break; 26 | } else { 27 | this.pop().dispose(); 28 | } 29 | } 30 | } 31 | 32 | /** 33 | * Prune all tiles from the cache that don't have the same z as the newest tile. 34 | */ 35 | pruneExceptNewestZ() { 36 | if (this.getCount() === 0) { 37 | return; 38 | } 39 | const key = this.peekFirstKey(); 40 | const tileCoord = fromKey(key); 41 | const z = tileCoord[0]; 42 | this.forEach(function(tile) { 43 | if (tile.tileCoord[0] !== z) { 44 | this.remove(getKey(tile.tileCoord)); 45 | tile.dispose(); 46 | } 47 | }.bind(this)); 48 | } 49 | } 50 | 51 | 52 | export default TileCache; 53 | -------------------------------------------------------------------------------- /src/ol/has.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/has 3 | */ 4 | 5 | const ua = typeof navigator !== 'undefined' ? 6 | navigator.userAgent.toLowerCase() : ''; 7 | 8 | /** 9 | * User agent string says we are dealing with Firefox as browser. 10 | * @type {boolean} 11 | */ 12 | export const FIREFOX = ua.indexOf('firefox') !== -1; 13 | 14 | /** 15 | * User agent string says we are dealing with Safari as browser. 16 | * @type {boolean} 17 | */ 18 | export const SAFARI = ua.indexOf('safari') !== -1 && ua.indexOf('chrom') == -1; 19 | 20 | /** 21 | * User agent string says we are dealing with a WebKit engine. 22 | * @type {boolean} 23 | */ 24 | export const WEBKIT = ua.indexOf('webkit') !== -1 && ua.indexOf('edge') == -1; 25 | 26 | /** 27 | * User agent string says we are dealing with a Mac as platform. 28 | * @type {boolean} 29 | */ 30 | export const MAC = ua.indexOf('macintosh') !== -1; 31 | 32 | 33 | /** 34 | * The ratio between physical pixels and device-independent pixels 35 | * (dips) on the device (`window.devicePixelRatio`). 36 | * @const 37 | * @type {number} 38 | * @api 39 | */ 40 | export const DEVICE_PIXEL_RATIO = window.devicePixelRatio || 1; 41 | 42 | /** 43 | * Image.prototype.decode() is supported. 44 | * @type {boolean} 45 | */ 46 | export const IMAGE_DECODE = typeof Image !== 'undefined' && Image.prototype.decode; 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PlotOL 2 | 3 | ### 说明 4 | 5 | 基于原作者cuifudong 博客地址https://blog.csdn.net/gispace OL3 改版。 6 | 7 | 基于OpenLayers6 (http://openlayers.org) 实现动态标绘API。 8 | 9 | 在线体验 http://61.155.169.52:8080/PlotOl/demo/index.html 10 | 11 | ## 现在已经支持IE 12 | 13 | 版本V1.0,实现的功能包括: 14 | - 标绘符号绘制; 15 | - 标绘符号编辑; 16 | - 实现的线状符号:弧线、曲线、折线、自由线; 17 | - 实现的面状符号:圆、椭圆、弓形、扇形、曲线面、集结地、多边形、自由面; 18 | - 实现的箭头符号:钳击、直箭头、细直箭头、突击方向、进攻方向、进攻方向(燕尾)、分队战斗行动、分队战斗行动(燕尾); 19 | 20 | 版本V1.1,实现的功能包括: 21 | - 全面支持移动端 22 | - 图元层级编辑 23 | - 图元样式,属性编辑 24 | - 实现序列化,可以按照自己的服务器存储格式修改序列化代码,实现保存和加载。 25 | 26 | 当前版本V1.1.1,实现的功能包括: 27 | - 增加文档工具,生成API文档(需要重新install才可以使用)npm run docs 28 | - 标绘图元新增disable,enable方法 29 | - 新增TrackingLayer类,可以用来绘制轨迹。POL.TrackingLayer 30 | 31 | 当前版本V1.1.2,实现的功能包括: 32 | - IE 支持 通过 npm run build-ie 再在应用html中引入 dist/polyfill.js 可以支持ie 33 | 34 | ### 演示截图 35 | 36 | 37 | 38 |
39 | 40 | 41 | ### 编译 42 | ``` 43 | npm install 安装 44 | ``` 45 | 46 | 47 | ``` 48 | npm run start 开发者模式 49 | ``` 50 | 51 | ``` 52 | npm run start-ie 开发者模式(ie) 53 | ``` 54 | 55 | 56 | ``` 57 | npm run build 发布普通兼容性浏览器 58 | ``` 59 | 60 | ``` 61 | npm run build-ie 发布兼容性ie版本 62 | ``` 63 | 64 | ``` 65 | npm run docs 编译文档 66 | ``` -------------------------------------------------------------------------------- /src/plot/style/MarkerStyle.js: -------------------------------------------------------------------------------- 1 | 2 | import FTStyle from "./Style"; 3 | import Style from '../../ol/style/Style' 4 | import Stroke from '../../ol/style/Stroke' 5 | import Fill from '../../ol/style/Fill' 6 | import Icon from '../../ol/style/Icon' 7 | class MarkerStyle extends FTStyle { 8 | 9 | /** 10 | * @class MarkerStyle 11 | * @classdesc 点类样式 12 | * @extends {FTStyle} 13 | * @author daiyujie 14 | * @constructs 15 | */ 16 | constructor() { 17 | super(); 18 | this._style = { 19 | image: { 20 | //--ol.Image 的全部属性 21 | icon: { 22 | src: './assets/marker-begin.png', 23 | offset: [0, 0], 24 | opacity: 1, 25 | scale: 1, 26 | anchor: [0.5, 0.5], 27 | offset: [0, 0], 28 | scale: 1 29 | } 30 | } 31 | 32 | } 33 | } 34 | parse() { 35 | let image = null; 36 | 37 | if (this._style.image) { 38 | if (this._style.image.icon) { 39 | image = new Icon(this._style.image.icon) 40 | } 41 | } 42 | 43 | return new Style({ 44 | image: image 45 | }); 46 | } 47 | 48 | 49 | } 50 | export default MarkerStyle -------------------------------------------------------------------------------- /src/plot/plots/Circle.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | import Plot from './Plot' 4 | import PlotTypes from '../PlotTypes' 5 | import Polygon from '../../ol/geom/Polygon' 6 | import {distance} from '../utils/plot_util' 7 | import Constants from '../Constants' 8 | import mix from '../../util/mixin' 9 | export default class Circle extends mix(Plot,Polygon){ 10 | 11 | constructor(points) { 12 | super(points); 13 | this.type = PlotTypes.CIRCLE; 14 | this.fixPointCount = 2; 15 | this.setPoints(points); 16 | } 17 | generate() { 18 | var count = this.getPointCount(); 19 | if (count < 2) { 20 | return; 21 | } 22 | var center = this.points[0]; 23 | var radius = distance(center, this.points[1]); 24 | this.setCoordinates([this.generatePoints(center, radius)]); 25 | } 26 | generatePoints(center, radius) { 27 | var x, y, angle, points = []; 28 | for (var i = 0; i <= Constants.FITTING_COUNT; i++) { 29 | angle = Math.PI * 2 * i / Constants.FITTING_COUNT; 30 | x = center[0] + radius * Math.cos(angle); 31 | y = center[1] + radius * Math.sin(angle); 32 | points.push([x, y]); 33 | } 34 | return points; 35 | }; 36 | 37 | 38 | 39 | 40 | } 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /src/plot/plots/StraightArrow.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | import Plot from './Plot' 4 | import PlotTypes from '../PlotTypes' 5 | import LineString from '../../ol/geom/LineString' 6 | import mix from '../../util/mixin' 7 | import * as PlotUtils from '../utils/plot_util' 8 | import Constants from '../Constants' 9 | //--fix dyj 目前mix函数只支持简单对象的拷贝,Plot必须放在复杂对象前面 10 | export default class StraightArrow extends mix(Plot, LineString) { 11 | 12 | constructor(points) { 13 | super(points); 14 | this.type = PlotTypes.STRAIGHT_ARROW; 15 | this.fixPointCount = 2; 16 | this.maxArrowLength = 3000000; 17 | this.arrowLengthScale = 5; 18 | this.setPoints(points); 19 | } 20 | generate() { 21 | if (this.getPointCount() < 2) { 22 | return; 23 | } 24 | var pnts = this.getPoints(); 25 | var pnt1 = pnts[0]; 26 | var pnt2 = pnts[1]; 27 | var distance = PlotUtils.distance(pnt1, pnt2); 28 | var len = distance / this.arrowLengthScale; 29 | len = len > this.maxArrowLength ? this.maxArrowLength : len; 30 | var leftPnt = PlotUtils.getThirdPoint(pnt1, pnt2, Math.PI / 6, len, false); 31 | var rightPnt = PlotUtils.getThirdPoint(pnt1, pnt2, Math.PI / 6, len, true); 32 | this.setCoordinates([pnt1, pnt2, leftPnt, pnt2, rightPnt]); 33 | } 34 | 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /src/ol/AssertionError.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/AssertionError 3 | */ 4 | import {VERSION} from './util.js'; 5 | 6 | /** 7 | * Error object thrown when an assertion failed. This is an ECMA-262 Error, 8 | * extended with a `code` property. 9 | * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error. 10 | */ 11 | class AssertionError extends Error { 12 | 13 | /** 14 | * @param {number} code Error code. 15 | */ 16 | constructor(code) { 17 | const path = VERSION === 'latest' ? VERSION : 'v' + VERSION.split('-')[0]; 18 | const message = 'Assertion failed. See https://openlayers.org/en/' + path + 19 | '/doc/errors/#' + code + ' for details.'; 20 | 21 | super(message); 22 | 23 | /** 24 | * Error code. The meaning of the code can be found on 25 | * https://openlayers.org/en/latest/doc/errors/ (replace `latest` with 26 | * the version found in the OpenLayers script's header comment if a version 27 | * other than the latest is used). 28 | * @type {number} 29 | * @api 30 | */ 31 | this.code = code; 32 | 33 | /** 34 | * @type {string} 35 | */ 36 | this.name = 'AssertionError'; 37 | 38 | // Re-assign message, see https://github.com/Rich-Harris/buble/issues/40 39 | this.message = message; 40 | } 41 | 42 | } 43 | 44 | export default AssertionError; 45 | -------------------------------------------------------------------------------- /src/ol/string.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/string 3 | */ 4 | 5 | /** 6 | * @param {number} number Number to be formatted 7 | * @param {number} width The desired width 8 | * @param {number=} opt_precision Precision of the output string (i.e. number of decimal places) 9 | * @returns {string} Formatted string 10 | */ 11 | export function padNumber(number, width, opt_precision) { 12 | const numberString = opt_precision !== undefined ? number.toFixed(opt_precision) : '' + number; 13 | let decimal = numberString.indexOf('.'); 14 | decimal = decimal === -1 ? numberString.length : decimal; 15 | return decimal > width ? numberString : new Array(1 + width - decimal).join('0') + numberString; 16 | } 17 | 18 | 19 | /** 20 | * Adapted from https://github.com/omichelsen/compare-versions/blob/master/index.js 21 | * @param {string|number} v1 First version 22 | * @param {string|number} v2 Second version 23 | * @returns {number} Value 24 | */ 25 | export function compareVersions(v1, v2) { 26 | const s1 = ('' + v1).split('.'); 27 | const s2 = ('' + v2).split('.'); 28 | 29 | for (let i = 0; i < Math.max(s1.length, s2.length); i++) { 30 | const n1 = parseInt(s1[i] || '0', 10); 31 | const n2 = parseInt(s2[i] || '0', 10); 32 | 33 | if (n1 > n2) { 34 | return 1; 35 | } 36 | if (n2 > n1) { 37 | return -1; 38 | } 39 | } 40 | 41 | return 0; 42 | } 43 | -------------------------------------------------------------------------------- /src/ol/net.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/net 3 | */ 4 | import {getUid} from './util.js'; 5 | 6 | 7 | /** 8 | * Simple JSONP helper. Supports error callbacks and a custom callback param. 9 | * The error callback will be called when no JSONP is executed after 10 seconds. 10 | * 11 | * @param {string} url Request url. A 'callback' query parameter will be 12 | * appended. 13 | * @param {Function} callback Callback on success. 14 | * @param {function()=} opt_errback Callback on error. 15 | * @param {string=} opt_callbackParam Custom query parameter for the JSONP 16 | * callback. Default is 'callback'. 17 | */ 18 | export function jsonp(url, callback, opt_errback, opt_callbackParam) { 19 | const script = document.createElement('script'); 20 | const key = 'olc_' + getUid(callback); 21 | function cleanup() { 22 | delete window[key]; 23 | script.parentNode.removeChild(script); 24 | } 25 | script.async = true; 26 | script.src = url + (url.indexOf('?') == -1 ? '?' : '&') + 27 | (opt_callbackParam || 'callback') + '=' + key; 28 | const timer = setTimeout(function() { 29 | cleanup(); 30 | if (opt_errback) { 31 | opt_errback(); 32 | } 33 | }, 10000); 34 | window[key] = function(data) { 35 | clearTimeout(timer); 36 | cleanup(); 37 | callback(data); 38 | }; 39 | document.getElementsByTagName('head')[0].appendChild(script); 40 | } 41 | -------------------------------------------------------------------------------- /src/ol/geom/flat/length.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/geom/flat/length 3 | */ 4 | 5 | 6 | /** 7 | * @param {Array
} flatCoordinates Flat coordinates. 8 | * @param {number} offset Offset. 9 | * @param {number} end End. 10 | * @param {number} stride Stride. 11 | * @return {number} Length. 12 | */ 13 | export function lineStringLength(flatCoordinates, offset, end, stride) { 14 | let x1 = flatCoordinates[offset]; 15 | let y1 = flatCoordinates[offset + 1]; 16 | let length = 0; 17 | for (let i = offset + stride; i < end; i += stride) { 18 | const x2 = flatCoordinates[i]; 19 | const y2 = flatCoordinates[i + 1]; 20 | length += Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)); 21 | x1 = x2; 22 | y1 = y2; 23 | } 24 | return length; 25 | } 26 | 27 | 28 | /** 29 | * @param {Array } flatCoordinates Flat coordinates. 30 | * @param {number} offset Offset. 31 | * @param {number} end End. 32 | * @param {number} stride Stride. 33 | * @return {number} Perimeter. 34 | */ 35 | export function linearRingLength(flatCoordinates, offset, end, stride) { 36 | let perimeter = lineStringLength(flatCoordinates, offset, end, stride); 37 | const dx = flatCoordinates[end - stride] - flatCoordinates[offset]; 38 | const dy = flatCoordinates[end - stride + 1] - flatCoordinates[offset + 1]; 39 | perimeter += Math.sqrt(dx * dx + dy * dy); 40 | return perimeter; 41 | } 42 | -------------------------------------------------------------------------------- /src/util/mixin.js: -------------------------------------------------------------------------------- 1 | //--fix dyj 多继承。目前还有缺陷 2 | function mix(...mixins) { 3 | class Mix { 4 | constructor(...ags) { 5 | for (let mixin of mixins) { 6 | copyProperties(this, new mixin(ags)); // 拷贝实例属性 7 | } 8 | } 9 | } 10 | 11 | for (let mixin of mixins) { 12 | copyProperties(Mix, mixin); // 拷贝静态属性 13 | copyProperties(Mix.prototype, mixin.prototype,true); // 拷贝原型属性 14 | } 15 | 16 | return Mix; 17 | } 18 | 19 | function copyProperties(target, source,deep) { 20 | for (var key of Reflect.ownKeys(source)) { 21 | if (key !== 'constructor' 22 | && key !== 'prototype' 23 | && key !== 'name' 24 | && key !== 'length'//--fix ie不支持拷贝函数对象的length属性 25 | ) { 26 | let desc = Object.getOwnPropertyDescriptor(source, key); 27 | Object.defineProperty(target, key, desc); 28 | } 29 | } 30 | if (deep && source.__proto__ && target.__proto__) { 31 | target.__proto__ = source.__proto__; 32 | 33 | // for (let key2 of Reflect.ownKeys(source.__proto__)) { 34 | // let desc = Object.getOwnPropertyDescriptor(source.__proto__, key2); 35 | // Object.defineProperty(target.__proto__, key2, desc); 36 | // copyProperties(target.__proto__,source.__proto__); 37 | // } 38 | } 39 | } 40 | export default mix; -------------------------------------------------------------------------------- /src/ol/render/Event.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/render/Event 3 | */ 4 | 5 | import Event from '../events/Event.js'; 6 | 7 | class RenderEvent extends Event { 8 | 9 | /** 10 | * @param {import("./EventType.js").default} type Type. 11 | * @param {import("../transform.js").Transform=} opt_inversePixelTransform Transform for 12 | * CSS pixels to rendered pixels. 13 | * @param {import("../PluggableMap.js").FrameState=} opt_frameState Frame state. 14 | * @param {?CanvasRenderingContext2D=} opt_context Context. 15 | */ 16 | constructor(type, opt_inversePixelTransform, opt_frameState, opt_context) { 17 | 18 | super(type); 19 | 20 | /** 21 | * Transform from CSS pixels (relative to the top-left corner of the map viewport) 22 | * to rendered pixels on this event's `context`. 23 | * @type {import("../transform.js").Transform|undefined} 24 | * @api 25 | */ 26 | this.inversePixelTransform = opt_inversePixelTransform; 27 | 28 | /** 29 | * An object representing the current render frame state. 30 | * @type {import("../PluggableMap.js").FrameState|undefined} 31 | * @api 32 | */ 33 | this.frameState = opt_frameState; 34 | 35 | /** 36 | * Canvas context. Only available when a Canvas renderer is used, null 37 | * otherwise. 38 | * @type {CanvasRenderingContext2D|null|undefined} 39 | * @api 40 | */ 41 | this.context = opt_context; 42 | 43 | } 44 | 45 | } 46 | 47 | export default RenderEvent; 48 | -------------------------------------------------------------------------------- /src/plot/plots/Ellipse.js: -------------------------------------------------------------------------------- 1 | import Plot from './Plot' 2 | import PlotTypes from '../PlotTypes' 3 | import PolygonOL from '../../ol/geom/Polygon' 4 | import mix from '../../util/mixin' 5 | import Constants from '../Constants' 6 | import * as PlotUtils from '../utils/plot_util' 7 | export default class Ellipse extends mix(Plot, PolygonOL) { 8 | 9 | constructor(points) { 10 | super(points); 11 | this.type = PlotTypes.ELLIPSE; 12 | this.fixPointCount = 2; 13 | this.setPoints(points); 14 | } 15 | generate() { 16 | var count = this.getPointCount(); 17 | if (count < 2) { 18 | return; 19 | } 20 | var pnt1 = this.points[0]; 21 | var pnt2 = this.points[1]; 22 | var center = PlotUtils.mid(pnt1, pnt2); 23 | var majorRadius = Math.abs((pnt1[0] - pnt2[0]) / 2); 24 | var minorRadius = Math.abs((pnt1[1] - pnt2[1]) / 2); 25 | this.setCoordinates([this.generatePoints(center, majorRadius, minorRadius)]); 26 | } 27 | generatePoints(center, majorRadius, minorRadius) { 28 | var x, y, angle, points = []; 29 | for (var i = 0; i <= Constants.FITTING_COUNT; i++) { 30 | angle = Math.PI * 2 * i / Constants.FITTING_COUNT; 31 | x = center[0] + majorRadius * Math.cos(angle); 32 | y = center[1] + minorRadius * Math.sin(angle); 33 | points.push([x, y]); 34 | } 35 | return points; 36 | } 37 | 38 | } 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /src/ol/easing.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/easing 3 | */ 4 | 5 | 6 | /** 7 | * Start slow and speed up. 8 | * @param {number} t Input between 0 and 1. 9 | * @return {number} Output between 0 and 1. 10 | * @api 11 | */ 12 | export function easeIn(t) { 13 | return Math.pow(t, 3); 14 | } 15 | 16 | 17 | /** 18 | * Start fast and slow down. 19 | * @param {number} t Input between 0 and 1. 20 | * @return {number} Output between 0 and 1. 21 | * @api 22 | */ 23 | export function easeOut(t) { 24 | return 1 - easeIn(1 - t); 25 | } 26 | 27 | 28 | /** 29 | * Start slow, speed up, and then slow down again. 30 | * @param {number} t Input between 0 and 1. 31 | * @return {number} Output between 0 and 1. 32 | * @api 33 | */ 34 | export function inAndOut(t) { 35 | return 3 * t * t - 2 * t * t * t; 36 | } 37 | 38 | 39 | /** 40 | * Maintain a constant speed over time. 41 | * @param {number} t Input between 0 and 1. 42 | * @return {number} Output between 0 and 1. 43 | * @api 44 | */ 45 | export function linear(t) { 46 | return t; 47 | } 48 | 49 | 50 | /** 51 | * Start slow, speed up, and at the very end slow down again. This has the 52 | * same general behavior as {@link module:ol/easing~inAndOut}, but the final 53 | * slowdown is delayed. 54 | * @param {number} t Input between 0 and 1. 55 | * @return {number} Output between 0 and 1. 56 | * @api 57 | */ 58 | export function upAndDown(t) { 59 | if (t < 0.5) { 60 | return inAndOut(2 * t); 61 | } else { 62 | return 1 - inAndOut(2 * (t - 0.5)); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /docs/templates/jaguarjs/README.md: -------------------------------------------------------------------------------- 1 | Jaguar.js template for JSDoc 3 2 | --- 3 | - [Jaguar.js](http://davidshimjs.github.io/jaguarjs) 4 | - [Jaguar.js Documentations](http://davidshimjs.github.io/jaguarjs/doc) 5 | - [JSDoc3](https://github.com/jsdoc3/jsdoc) 6 | - [JSDoc3 API Documentations](http://usejsdoc.org) 7 | 8 | Usage 9 | --- 10 | 1. If you want to create documentations with sample files, you can use commands below. 11 | ``` 12 | $ npm install 13 | $ grunt demo 14 | ``` 15 | 16 | 2. You can see any output related jsdoc process with a `--debug` flag. 17 | ``` 18 | $ grunt demo --debug 19 | ``` 20 | 21 | 3. If you already have jsdoc system, you can use this project as jsdoc template. 22 | ``` 23 | $ jsdoc -t `project folder` -c `configuration file` `source files` `README.md file` 24 | ``` 25 | 26 | conf.json 27 | --- 28 | You can set options for customizing your documentations. 29 | 30 | ``` 31 | "templates": { 32 | "applicationName": "Demo", 33 | "disqus": "", 34 | "googleAnalytics": "", 35 | "openGraph": { 36 | "title": "", 37 | "type": "website", 38 | "image": "", 39 | "site_name": "", 40 | "url": "" 41 | }, 42 | "meta": { 43 | "title": "", 44 | "description": "", 45 | "keyword": "" 46 | }, 47 | "linenums": true 48 | } 49 | ``` 50 | 51 | License 52 | --- 53 | This project under the MIT License. and this project refered by default template for JSDoc 3. 54 | 55 | [](https://bitdeli.com/free "Bitdeli Badge") 56 | 57 | -------------------------------------------------------------------------------- /src/ol/geom/flat/straightchunk.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/geom/flat/straightchunk 3 | */ 4 | 5 | 6 | /** 7 | * @param {number} maxAngle Maximum acceptable angle delta between segments. 8 | * @param {Array } flatCoordinates Flat coordinates. 9 | * @param {number} offset Offset. 10 | * @param {number} end End. 11 | * @param {number} stride Stride. 12 | * @return {Array } Start and end of the first suitable chunk of the 13 | * given `flatCoordinates`. 14 | */ 15 | export function matchingChunk(maxAngle, flatCoordinates, offset, end, stride) { 16 | let chunkStart = offset; 17 | let chunkEnd = offset; 18 | let chunkM = 0; 19 | let m = 0; 20 | let start = offset; 21 | let acos, i, m12, m23, x1, y1, x12, y12, x23, y23; 22 | for (i = offset; i < end; i += stride) { 23 | const x2 = flatCoordinates[i]; 24 | const y2 = flatCoordinates[i + 1]; 25 | if (x1 !== undefined) { 26 | x23 = x2 - x1; 27 | y23 = y2 - y1; 28 | m23 = Math.sqrt(x23 * x23 + y23 * y23); 29 | if (x12 !== undefined) { 30 | m += m12; 31 | acos = Math.acos((x12 * x23 + y12 * y23) / (m12 * m23)); 32 | if (acos > maxAngle) { 33 | if (m > chunkM) { 34 | chunkM = m; 35 | chunkStart = start; 36 | chunkEnd = i; 37 | } 38 | m = 0; 39 | start = i - stride; 40 | } 41 | } 42 | m12 = m23; 43 | x12 = x23; 44 | y12 = y23; 45 | } 46 | x1 = x2; 47 | y1 = y2; 48 | } 49 | m += m23; 50 | return m > chunkM ? [start, i] : [chunkStart, chunkEnd]; 51 | } 52 | -------------------------------------------------------------------------------- /src/ol/style/Circle.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/style/Circle 3 | */ 4 | 5 | import RegularShape from './RegularShape.js'; 6 | 7 | 8 | /** 9 | * @typedef {Object} Options 10 | * @property {import("./Fill.js").default} [fill] Fill style. 11 | * @property {number} radius Circle radius. 12 | * @property {import("./Stroke.js").default} [stroke] Stroke style. 13 | */ 14 | 15 | 16 | /** 17 | * @classdesc 18 | * Set circle style for vector features. 19 | * @api 20 | */ 21 | class CircleStyle extends RegularShape { 22 | /** 23 | * @param {Options=} opt_options Options. 24 | */ 25 | constructor(opt_options) { 26 | 27 | const options = opt_options ? opt_options : {}; 28 | 29 | super({ 30 | points: Infinity, 31 | fill: options.fill, 32 | radius: options.radius, 33 | stroke: options.stroke 34 | }); 35 | 36 | } 37 | 38 | /** 39 | * Clones the style. 40 | * @return {CircleStyle} The cloned style. 41 | * @override 42 | * @api 43 | */ 44 | clone() { 45 | const style = new CircleStyle({ 46 | fill: this.getFill() ? this.getFill().clone() : undefined, 47 | stroke: this.getStroke() ? this.getStroke().clone() : undefined, 48 | radius: this.getRadius() 49 | }); 50 | style.setOpacity(this.getOpacity()); 51 | style.setScale(this.getScale()); 52 | return style; 53 | } 54 | 55 | /** 56 | * Set the circle radius. 57 | * 58 | * @param {number} radius Circle radius. 59 | * @api 60 | */ 61 | setRadius(radius) { 62 | this.radius_ = radius; 63 | this.render(); 64 | } 65 | } 66 | 67 | 68 | export default CircleStyle; 69 | -------------------------------------------------------------------------------- /src/plot/plots/Arc.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | import Plot from './Plot' 6 | import PlotTypes from '../PlotTypes' 7 | import LineString from '../../ol/geom/LineString' 8 | import * as PlotUtils from '../utils/plot_util' 9 | import mix from '../../util/mixin' 10 | //--fix dyj 目前mix函数只支持简单对象的拷贝,Plot必须放在复杂对象前面 11 | export default class Arc extends mix(Plot, LineString) { 12 | 13 | constructor(points) { 14 | super(points); 15 | this.type = PlotTypes.ARC; 16 | this.fixPointCount = 3; 17 | this.setPoints(points); 18 | } 19 | generate() { 20 | var count = this.getPointCount(); 21 | if (count < 2) { 22 | return; 23 | } 24 | if (count == 2) { 25 | this.setCoordinates(this.points); 26 | } else { 27 | var pnt1 = this.points[0]; 28 | var pnt2 = this.points[1]; 29 | var pnt3 = this.points[2]; 30 | var center = PlotUtils.getCircleCenterOfThreePoints(pnt1, pnt2, pnt3); 31 | var radius = PlotUtils.distance(pnt1, center); 32 | 33 | var angle1 = PlotUtils.getAzimuth(pnt1, center); 34 | var angle2 = PlotUtils.getAzimuth(pnt2, center); 35 | if (PlotUtils.isClockWise(pnt1, pnt2, pnt3)) { 36 | var startAngle = angle2; 37 | var endAngle = angle1; 38 | } 39 | else { 40 | startAngle = angle1; 41 | endAngle = angle2; 42 | } 43 | this.setCoordinates(PlotUtils.getArcPoints(center, radius, startAngle, endAngle)); 44 | } 45 | } 46 | 47 | } 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /src/ol/MapBrowserEventType.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/MapBrowserEventType 3 | */ 4 | import EventType from './events/EventType.js'; 5 | 6 | /** 7 | * Constants for event names. 8 | * @enum {string} 9 | */ 10 | export default { 11 | 12 | /** 13 | * A true single click with no dragging and no double click. Note that this 14 | * event is delayed by 250 ms to ensure that it is not a double click. 15 | * @event module:ol/MapBrowserEvent~MapBrowserEvent#singleclick 16 | * @api 17 | */ 18 | SINGLECLICK: 'singleclick', 19 | 20 | /** 21 | * A click with no dragging. A double click will fire two of this. 22 | * @event module:ol/MapBrowserEvent~MapBrowserEvent#click 23 | * @api 24 | */ 25 | CLICK: EventType.CLICK, 26 | 27 | /** 28 | * A true double click, with no dragging. 29 | * @event module:ol/MapBrowserEvent~MapBrowserEvent#dblclick 30 | * @api 31 | */ 32 | DBLCLICK: EventType.DBLCLICK, 33 | 34 | /** 35 | * Triggered when a pointer is dragged. 36 | * @event module:ol/MapBrowserEvent~MapBrowserEvent#pointerdrag 37 | * @api 38 | */ 39 | POINTERDRAG: 'pointerdrag', 40 | 41 | /** 42 | * Triggered when a pointer is moved. Note that on touch devices this is 43 | * triggered when the map is panned, so is not the same as mousemove. 44 | * @event module:ol/MapBrowserEvent~MapBrowserEvent#pointermove 45 | * @api 46 | */ 47 | POINTERMOVE: 'pointermove', 48 | 49 | POINTERDOWN: 'pointerdown', 50 | POINTERUP: 'pointerup', 51 | POINTEROVER: 'pointerover', 52 | POINTEROUT: 'pointerout', 53 | POINTERENTER: 'pointerenter', 54 | POINTERLEAVE: 'pointerleave', 55 | POINTERCANCEL: 'pointercancel' 56 | }; 57 | -------------------------------------------------------------------------------- /src/ol/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol 3 | */ 4 | 5 | export {default as AssertionError} from './AssertionError.js'; 6 | export {default as Collection} from './Collection.js'; 7 | export {default as Disposable} from './Disposable.js'; 8 | export {default as Feature} from './Feature.js'; 9 | export {default as Geolocation} from './Geolocation.js'; 10 | export {default as Graticule} from './layer/Graticule.js'; 11 | export {default as Image} from './Image.js'; 12 | export {default as ImageBase} from './ImageBase.js'; 13 | export {default as ImageCanvas} from './ImageCanvas.js'; 14 | export {default as ImageTile} from './ImageTile.js'; 15 | export {default as Kinetic} from './Kinetic.js'; 16 | export {default as Map} from './Map.js'; 17 | export {default as MapBrowserEvent} from './MapBrowserEvent.js'; 18 | export {default as MapBrowserEventHandler} from './MapBrowserEventHandler.js'; 19 | export {default as MapBrowserPointerEvent} from './MapBrowserPointerEvent.js'; 20 | export {default as MapEvent} from './MapEvent.js'; 21 | export {default as Object} from './Object.js'; 22 | export {default as Observable} from './Observable.js'; 23 | export {default as Overlay} from './Overlay.js'; 24 | export {default as PluggableMap} from './PluggableMap.js'; 25 | export {default as Tile} from './Tile.js'; 26 | export {default as TileCache} from './TileCache.js'; 27 | export {default as TileQueue} from './TileQueue.js'; 28 | export {default as TileRange} from './TileRange.js'; 29 | export {default as VectorRenderTile} from './VectorRenderTile.js'; 30 | export {default as VectorTile} from './VectorTile.js'; 31 | export {default as View} from './View.js'; 32 | 33 | export {getUid, VERSION} from './util.js'; 34 | -------------------------------------------------------------------------------- /src/ol/events/Event.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/events/Event 3 | */ 4 | 5 | /** 6 | * @classdesc 7 | * Stripped down implementation of the W3C DOM Level 2 Event interface. 8 | * See https://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-interface. 9 | * 10 | * This implementation only provides `type` and `target` properties, and 11 | * `stopPropagation` and `preventDefault` methods. It is meant as base class 12 | * for higher level events defined in the library, and works with 13 | * {@link module:ol/events/Target~Target}. 14 | */ 15 | class Event { 16 | 17 | /** 18 | * @param {string} type Type. 19 | */ 20 | constructor(type) { 21 | 22 | /** 23 | * @type {boolean} 24 | */ 25 | this.propagationStopped; 26 | 27 | /** 28 | * The event type. 29 | * @type {string} 30 | * @api 31 | */ 32 | this.type = type; 33 | 34 | /** 35 | * The event target. 36 | * @type {Object} 37 | * @api 38 | */ 39 | this.target = null; 40 | } 41 | 42 | /** 43 | * Stop event propagation. 44 | * @api 45 | */ 46 | preventDefault() { 47 | this.propagationStopped = true; 48 | } 49 | 50 | /** 51 | * Stop event propagation. 52 | * @api 53 | */ 54 | stopPropagation() { 55 | this.propagationStopped = true; 56 | } 57 | 58 | } 59 | 60 | 61 | /** 62 | * @param {Event|import("./Event.js").default} evt Event 63 | */ 64 | export function stopPropagation(evt) { 65 | evt.stopPropagation(); 66 | } 67 | 68 | 69 | /** 70 | * @param {Event|import("./Event.js").default} evt Event 71 | */ 72 | export function preventDefault(evt) { 73 | evt.preventDefault(); 74 | } 75 | 76 | export default Event; 77 | -------------------------------------------------------------------------------- /src/ol/source.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/source 3 | */ 4 | 5 | export {default as BingMaps} from './source/BingMaps.js'; 6 | export {default as CartoDB} from './source/CartoDB.js'; 7 | export {default as Cluster} from './source/Cluster.js'; 8 | export {default as IIIF} from './source/IIIF.js'; 9 | export {default as Image} from './source/Image.js'; 10 | export {default as ImageArcGISRest} from './source/ImageArcGISRest.js'; 11 | export {default as ImageCanvas} from './source/ImageCanvas.js'; 12 | export {default as ImageMapGuide} from './source/ImageMapGuide.js'; 13 | export {default as ImageStatic} from './source/ImageStatic.js'; 14 | export {default as ImageWMS} from './source/ImageWMS.js'; 15 | export {default as OSM} from './source/OSM.js'; 16 | export {default as Raster} from './source/Raster.js'; 17 | export {default as Source} from './source/Source.js'; 18 | export {default as Stamen} from './source/Stamen.js'; 19 | export {default as Tile} from './source/Tile.js'; 20 | export {default as TileArcGISRest} from './source/TileArcGISRest.js'; 21 | export {default as TileDebug} from './source/TileDebug.js'; 22 | export {default as TileImage} from './source/TileImage.js'; 23 | export {default as TileJSON} from './source/TileJSON.js'; 24 | export {default as TileWMS} from './source/TileWMS.js'; 25 | export {default as UrlTile} from './source/UrlTile.js'; 26 | export {default as UTFGrid} from './source/UTFGrid.js'; 27 | export {default as Vector} from './source/Vector.js'; 28 | export {default as VectorTile} from './source/VectorTile.js'; 29 | export {default as WMTS} from './source/WMTS.js'; 30 | export {default as XYZ} from './source/XYZ.js'; 31 | export {default as Zoomify} from './source/Zoomify.js'; 32 | -------------------------------------------------------------------------------- /src/ol/proj/proj4.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/proj/proj4 3 | */ 4 | import {addCoordinateTransforms, addProjection, addEquivalentProjections, get} from '../proj.js'; 5 | import {get as getTransform} from './transforms.js'; 6 | import Projection from './Projection.js'; 7 | 8 | /** 9 | * Make projections defined in proj4 (with `proj4.defs()`) available in 10 | * OpenLayers. 11 | * 12 | * This function should be called whenever changes are made to the proj4 13 | * registry, e.g. after calling `proj4.defs()`. Existing transforms will not be 14 | * modified by this function. 15 | * 16 | * @param {?} proj4 Proj4. 17 | * @api 18 | */ 19 | export function register(proj4) { 20 | const projCodes = Object.keys(proj4.defs); 21 | const len = projCodes.length; 22 | let i, j; 23 | for (i = 0; i < len; ++i) { 24 | const code = projCodes[i]; 25 | if (!get(code)) { 26 | const def = proj4.defs(code); 27 | addProjection(new Projection({ 28 | code: code, 29 | axisOrientation: def.axis, 30 | metersPerUnit: def.to_meter, 31 | units: def.units 32 | })); 33 | } 34 | } 35 | for (i = 0; i < len; ++i) { 36 | const code1 = projCodes[i]; 37 | const proj1 = get(code1); 38 | for (j = 0; j < len; ++j) { 39 | const code2 = projCodes[j]; 40 | const proj2 = get(code2); 41 | if (!getTransform(code1, code2)) { 42 | if (proj4.defs[code1] === proj4.defs[code2]) { 43 | addEquivalentProjections([proj1, proj2]); 44 | } else { 45 | const transform = proj4(code1, code2); 46 | addCoordinateTransforms(proj1, proj2, transform.forward, transform.inverse); 47 | } 48 | } 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/ol/format/filter/IsLike.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/format/filter/IsLike 3 | */ 4 | import Comparison from './Comparison.js'; 5 | 6 | /** 7 | * @classdesc 8 | * Represents a ` ` comparison operator. 9 | * @api 10 | */ 11 | class IsLike extends Comparison { 12 | 13 | /** 14 | * [constructor description] 15 | * @param {!string} propertyName Name of the context property to compare. 16 | * @param {!string} pattern Text pattern. 17 | * @param {string=} opt_wildCard Pattern character which matches any sequence of 18 | * zero or more string characters. Default is '*'. 19 | * @param {string=} opt_singleChar pattern character which matches any single 20 | * string character. Default is '.'. 21 | * @param {string=} opt_escapeChar Escape character which can be used to escape 22 | * the pattern characters. Default is '!'. 23 | * @param {boolean=} opt_matchCase Case-sensitive? 24 | */ 25 | constructor(propertyName, pattern, opt_wildCard, opt_singleChar, opt_escapeChar, opt_matchCase) { 26 | super('PropertyIsLike', propertyName); 27 | 28 | /** 29 | * @type {!string} 30 | */ 31 | this.pattern = pattern; 32 | 33 | /** 34 | * @type {!string} 35 | */ 36 | this.wildCard = (opt_wildCard !== undefined) ? opt_wildCard : '*'; 37 | 38 | /** 39 | * @type {!string} 40 | */ 41 | this.singleChar = (opt_singleChar !== undefined) ? opt_singleChar : '.'; 42 | 43 | /** 44 | * @type {!string} 45 | */ 46 | this.escapeChar = (opt_escapeChar !== undefined) ? opt_escapeChar : '!'; 47 | 48 | /** 49 | * @type {boolean|undefined} 50 | */ 51 | this.matchCase = opt_matchCase; 52 | 53 | } 54 | } 55 | 56 | export default IsLike; 57 | -------------------------------------------------------------------------------- /src/plot/plots/Lune.js: -------------------------------------------------------------------------------- 1 | import Plot from './Plot' 2 | import PlotTypes from '../PlotTypes' 3 | import PolygonOL from '../../ol/geom/Polygon' 4 | import mix from '../../util/mixin' 5 | import * as PlotUtils from '../utils/plot_util' 6 | import Constants from '../Constants' 7 | export default class Lune extends mix(Plot, PolygonOL) { 8 | 9 | constructor(points) { 10 | super(points); 11 | this.type = PlotTypes.LUNE; 12 | this.fixPointCount = 3; 13 | this.setPoints(points); 14 | } 15 | generate() { 16 | if (this.getPointCount() < 2) { 17 | return; 18 | } 19 | var pnts = this.getPoints(); 20 | if (this.getPointCount() == 2) { 21 | var mid = PlotUtils.mid(pnts[0], pnts[1]); 22 | var d = PlotUtils.distance(pnts[0], mid); 23 | var pnt = PlotUtils.getThirdPoint(pnts[0], mid, Constants.HALF_PI, d); 24 | pnts.push(pnt); 25 | } 26 | var pnt1 = pnts[0]; 27 | var pnt2 = pnts[1]; 28 | var pnt3 = pnts[2]; 29 | var center = PlotUtils.getCircleCenterOfThreePoints(pnt1, pnt2, pnt3); 30 | var radius = PlotUtils.distance(pnt1, center); 31 | 32 | var angle1 = PlotUtils.getAzimuth(pnt1, center); 33 | var angle2 = PlotUtils.getAzimuth(pnt2, center); 34 | if (PlotUtils.isClockWise(pnt1, pnt2, pnt3)) { 35 | var startAngle = angle2; 36 | var endAngle = angle1; 37 | } 38 | else { 39 | startAngle = angle1; 40 | endAngle = angle2; 41 | } 42 | var pnts = PlotUtils.getArcPoints(center, radius, startAngle, endAngle); 43 | pnts.push(pnts[0]); 44 | this.setCoordinates([pnts]); 45 | 46 | 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/ol/style/Fill.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/style/Fill 3 | */ 4 | 5 | 6 | /** 7 | * @typedef {Object} Options 8 | * @property {import("../color.js").Color|import("../colorlike.js").ColorLike} [color=null] A color, gradient or pattern. 9 | * See {@link module:ol/color~Color} and {@link module:ol/colorlike~ColorLike} for possible formats. 10 | * Default null; if null, the Canvas/renderer default black will be used. 11 | */ 12 | 13 | 14 | /** 15 | * @classdesc 16 | * Set fill style for vector features. 17 | * @api 18 | */ 19 | class Fill { 20 | /** 21 | * @param {Options=} opt_options Options. 22 | */ 23 | constructor(opt_options) { 24 | 25 | const options = opt_options || {}; 26 | 27 | /** 28 | * @private 29 | * @type {import("../color.js").Color|import("../colorlike.js").ColorLike} 30 | */ 31 | this.color_ = options.color !== undefined ? options.color : null; 32 | } 33 | 34 | /** 35 | * Clones the style. The color is not cloned if it is an {@link module:ol/colorlike~ColorLike}. 36 | * @return {Fill} The cloned style. 37 | * @api 38 | */ 39 | clone() { 40 | const color = this.getColor(); 41 | return new Fill({ 42 | color: Array.isArray(color) ? color.slice() : color || undefined 43 | }); 44 | } 45 | 46 | /** 47 | * Get the fill color. 48 | * @return {import("../color.js").Color|import("../colorlike.js").ColorLike} Color. 49 | * @api 50 | */ 51 | getColor() { 52 | return this.color_; 53 | } 54 | 55 | /** 56 | * Set the color. 57 | * 58 | * @param {import("../color.js").Color|import("../colorlike.js").ColorLike} color Color. 59 | * @api 60 | */ 61 | setColor(color) { 62 | this.color_ = color; 63 | } 64 | 65 | } 66 | 67 | export default Fill; 68 | -------------------------------------------------------------------------------- /src/plot/plots/Plot.js: -------------------------------------------------------------------------------- 1 | 2 | class Plot { 3 | /** 4 | * @classdesc 所有图元的基类,用来实现绘制图元。 5 | * @constructs 6 | * @author daiyujie 7 | * @param {ol.Coordinate} points 图元的点集 8 | */ 9 | constructor(points) { 10 | this.setPoints(points); 11 | this.geo_type ='RootTest'; 12 | } 13 | /** 14 | * 是否为图元 15 | */ 16 | isPlot() { 17 | return true; 18 | } 19 | /** 20 | * 设置点集 21 | * @param {ol.Coordinate} points 图元的点集 22 | */ 23 | setPoints(value) { 24 | this.points = value ? value : []; 25 | if (this.points.length >= 1) 26 | this.generate(); 27 | } 28 | /** 29 | * 获取当前图元的点集 30 | * @return {ol.Coordinate} 图元的点集 31 | */ 32 | getPoints() { 33 | return this.points.slice(0); 34 | } 35 | /** 36 | * 获取当前图元的点集数量 37 | * @return {Number} 图元的点集的数量 38 | */ 39 | getPointCount() { 40 | return this.points.length; 41 | } 42 | /** 43 | * 更新某个索引的点 44 | * @param {ol.Coordinate} point 点 45 | * @param {index} index 位置 46 | */ 47 | updatePoint(point, index) { 48 | if (index >= 0 && index < this.points.length) { 49 | this.points[index] = point; 50 | this.generate(); 51 | } 52 | } 53 | /** 54 | * 更新最后一个点 55 | * @param {ol.Coordinate} point 56 | */ 57 | updateLastPoint(point) { 58 | this.updatePoint(point, this.points.length - 1); 59 | } 60 | /** 61 | * @override 62 | * 图元绘制逻辑.各个图元用来覆盖 63 | */ 64 | generate() { 65 | //--TODO 66 | } 67 | /** 68 | * @override 69 | * 图元结束绘制回调 70 | */ 71 | finishDrawing() { 72 | //--TODO 73 | } 74 | } 75 | export default Plot; 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /src/ol/render/canvas/LabelCache.js: -------------------------------------------------------------------------------- 1 | import {getUid} from '../../util.js'; 2 | import LRUCache from '../../structs/LRUCache.js'; 3 | 4 | /** 5 | * @module ol/render/canvas/LabelCache 6 | */ 7 | 8 | /** 9 | * @classdesc 10 | * Cache of pre-rendered labels. 11 | * @fires import("../events/Event.js").Event 12 | */ 13 | class LabelCache extends LRUCache { 14 | 15 | /** 16 | * @inheritDoc 17 | */ 18 | constructor(opt_highWaterMark) { 19 | super(opt_highWaterMark); 20 | this.consumers = {}; 21 | } 22 | 23 | clear() { 24 | super.clear(); 25 | this.consumers = {}; 26 | } 27 | 28 | /** 29 | * @override 30 | * @param {string} key Label key. 31 | * @param {import("./Executor.js").default} consumer Label consumer. 32 | * @return {HTMLCanvasElement} Label. 33 | */ 34 | get(key, consumer) { 35 | const canvas = super.get(key); 36 | const consumerId = getUid(consumer); 37 | if (!(consumerId in this.consumers)) { 38 | this.consumers[consumerId] = {}; 39 | } 40 | this.consumers[consumerId][key] = true; 41 | return canvas; 42 | } 43 | 44 | prune() { 45 | outer: 46 | while (this.canExpireCache()) { 47 | const key = this.peekLastKey(); 48 | for (const consumerId in this.consumers) { 49 | if (key in this.consumers[consumerId]) { 50 | break outer; 51 | } 52 | } 53 | const canvas = this.pop(); 54 | canvas.width = canvas.height = 0; 55 | for (const consumerId in this.consumers) { 56 | delete this.consumers[consumerId][key]; 57 | } 58 | } 59 | } 60 | 61 | /** 62 | * @param {import("./Executor.js").default} consumer Label consumer. 63 | */ 64 | release(consumer) { 65 | delete this.consumers[getUid(consumer)]; 66 | } 67 | } 68 | 69 | export default LabelCache; 70 | -------------------------------------------------------------------------------- /src/ol/geom/flat/area.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/geom/flat/area 3 | */ 4 | 5 | 6 | /** 7 | * @param {Array } flatCoordinates Flat coordinates. 8 | * @param {number} offset Offset. 9 | * @param {number} end End. 10 | * @param {number} stride Stride. 11 | * @return {number} Area. 12 | */ 13 | export function linearRing(flatCoordinates, offset, end, stride) { 14 | let twiceArea = 0; 15 | let x1 = flatCoordinates[end - stride]; 16 | let y1 = flatCoordinates[end - stride + 1]; 17 | for (; offset < end; offset += stride) { 18 | const x2 = flatCoordinates[offset]; 19 | const y2 = flatCoordinates[offset + 1]; 20 | twiceArea += y1 * x2 - x1 * y2; 21 | x1 = x2; 22 | y1 = y2; 23 | } 24 | return twiceArea / 2; 25 | } 26 | 27 | 28 | /** 29 | * @param {Array } flatCoordinates Flat coordinates. 30 | * @param {number} offset Offset. 31 | * @param {Array } ends Ends. 32 | * @param {number} stride Stride. 33 | * @return {number} Area. 34 | */ 35 | export function linearRings(flatCoordinates, offset, ends, stride) { 36 | let area = 0; 37 | for (let i = 0, ii = ends.length; i < ii; ++i) { 38 | const end = ends[i]; 39 | area += linearRing(flatCoordinates, offset, end, stride); 40 | offset = end; 41 | } 42 | return area; 43 | } 44 | 45 | 46 | /** 47 | * @param {Array } flatCoordinates Flat coordinates. 48 | * @param {number} offset Offset. 49 | * @param {Array >} endss Endss. 50 | * @param {number} stride Stride. 51 | * @return {number} Area. 52 | */ 53 | export function linearRingss(flatCoordinates, offset, endss, stride) { 54 | let area = 0; 55 | for (let i = 0, ii = endss.length; i < ii; ++i) { 56 | const ends = endss[i]; 57 | area += linearRings(flatCoordinates, offset, ends, stride); 58 | offset = ends[ends.length - 1]; 59 | } 60 | return area; 61 | } 62 | -------------------------------------------------------------------------------- /src/ol/worker/webgl.js: -------------------------------------------------------------------------------- 1 | /** 2 | * A worker that does cpu-heavy tasks related to webgl rendering. 3 | * @module ol/worker/webgl 4 | */ 5 | import { 6 | POINT_INSTRUCTIONS_COUNT, 7 | POINT_VERTEX_STRIDE, 8 | WebGLWorkerMessageType, 9 | writePointFeatureToBuffers 10 | } from '../renderer/webgl/Layer.js'; 11 | import {assign} from '../obj.js'; 12 | 13 | onmessage = event => { 14 | const received = event.data; 15 | if (received.type === WebGLWorkerMessageType.GENERATE_BUFFERS) { 16 | const renderInstructions = new Float32Array(received.renderInstructions); 17 | const customAttributesCount = received.customAttributesCount || 0; 18 | const instructionsCount = POINT_INSTRUCTIONS_COUNT + customAttributesCount; 19 | 20 | const elementsCount = renderInstructions.length / instructionsCount; 21 | const indicesCount = elementsCount * 6; 22 | const verticesCount = elementsCount * 4 * (POINT_VERTEX_STRIDE + customAttributesCount); 23 | const indexBuffer = new Uint32Array(indicesCount); 24 | const vertexBuffer = new Float32Array(verticesCount); 25 | 26 | let bufferPositions = null; 27 | for (let i = 0; i < renderInstructions.length; i += instructionsCount) { 28 | bufferPositions = writePointFeatureToBuffers( 29 | renderInstructions, 30 | i, 31 | vertexBuffer, 32 | indexBuffer, 33 | bufferPositions, 34 | instructionsCount); 35 | } 36 | 37 | /** @type {import('../renderer/webgl/Layer').WebGLWorkerGenerateBuffersMessage} */ 38 | const message = assign({ 39 | vertexBuffer: vertexBuffer.buffer, 40 | indexBuffer: indexBuffer.buffer, 41 | renderInstructions: renderInstructions.buffer 42 | }, received); 43 | 44 | postMessage(message, [vertexBuffer.buffer, indexBuffer.buffer, renderInstructions.buffer]); 45 | } 46 | }; 47 | 48 | export let create; 49 | -------------------------------------------------------------------------------- /src/plot/plots/ClosedCurve.js: -------------------------------------------------------------------------------- 1 | 2 | import Plot from './Plot' 3 | import PlotTypes from '../PlotTypes' 4 | import PolygonOL from '../../ol/geom/Polygon' 5 | import mix from '../../util/mixin' 6 | import * as PlotUtils from '../utils/plot_util' 7 | import Constants from '../Constants' 8 | 9 | export default class ClosedCurve extends mix(Plot, PolygonOL) { 10 | 11 | constructor(points) { 12 | super(points); 13 | this.type = PlotTypes.CLOSED_CURVE; 14 | this.t = 0.3; 15 | this.setPoints(points); 16 | } 17 | generate() { 18 | var count = this.getPointCount(); 19 | if (count < 2) { 20 | return; 21 | } 22 | if (count == 2) { 23 | this.setCoordinates([this.points]); 24 | } 25 | else { 26 | var pnts = this.getPoints(); 27 | pnts.push(pnts[0], pnts[1]); 28 | var normals = []; 29 | for (var i = 0; i < pnts.length - 2; i++) { 30 | var normalPoints = PlotUtils.getBisectorNormals(this.t, pnts[i], pnts[i + 1], pnts[i + 2]); 31 | normals = normals.concat(normalPoints); 32 | } 33 | var count = normals.length; 34 | normals = [normals[count - 1]].concat(normals.slice(0, count - 1)); 35 | 36 | var pList = []; 37 | for (i = 0; i < pnts.length - 2; i++) { 38 | var pnt1 = pnts[i]; 39 | var pnt2 = pnts[i + 1]; 40 | pList.push(pnt1); 41 | for (var t = 0; t <= Constants.FITTING_COUNT; t++) { 42 | var pnt = PlotUtils.getCubicValue(t / Constants.FITTING_COUNT, pnt1, normals[i * 2], normals[i * 2 + 1], pnt2); 43 | pList.push(pnt); 44 | } 45 | pList.push(pnt2); 46 | } 47 | this.setCoordinates([pList]); 48 | } 49 | } 50 | 51 | 52 | } 53 | 54 | -------------------------------------------------------------------------------- /src/plot/plots/FineArrow.js: -------------------------------------------------------------------------------- 1 | import Plot from './Plot' 2 | import PlotTypes from '../PlotTypes' 3 | import PolygonOL from '../../ol/geom/Polygon' 4 | import mix from '../../util/mixin' 5 | import * as PlotUtils from '../utils/plot_util' 6 | import Constants from '../Constants' 7 | export default class FineArrow extends mix(Plot, PolygonOL) { 8 | 9 | constructor(points) { 10 | super(points); 11 | this.type = PlotTypes.FINE_ARROW; 12 | this.tailWidthFactor = 0.15; 13 | this.neckWidthFactor = 0.2; 14 | this.headWidthFactor = 0.25; 15 | this.headAngle = Math.PI / 8.5; 16 | this.neckAngle = Math.PI / 13; 17 | this.fixPointCount = 2; 18 | this.setPoints(points); 19 | } 20 | generate() { 21 | var count = this.getPointCount(); 22 | if (count < 2) { 23 | return; 24 | } 25 | var pnts = this.getPoints(); 26 | var pnt1 = pnts[0]; 27 | var pnt2 = pnts[1]; 28 | var len = PlotUtils.getBaseLength(pnts); 29 | var tailWidth = len * this.tailWidthFactor; 30 | var neckWidth = len * this.neckWidthFactor; 31 | var headWidth = len * this.headWidthFactor; 32 | var tailLeft = PlotUtils.getThirdPoint(pnt2, pnt1, Constants.HALF_PI, tailWidth, true); 33 | var tailRight = PlotUtils.getThirdPoint(pnt2, pnt1, Constants.HALF_PI, tailWidth, false); 34 | var headLeft = PlotUtils.getThirdPoint(pnt1, pnt2, this.headAngle, headWidth, false); 35 | var headRight = PlotUtils.getThirdPoint(pnt1, pnt2, this.headAngle, headWidth, true); 36 | var neckLeft = PlotUtils.getThirdPoint(pnt1, pnt2, this.neckAngle, neckWidth, false); 37 | var neckRight = PlotUtils.getThirdPoint(pnt1, pnt2, this.neckAngle, neckWidth, true); 38 | var pList = [tailLeft, neckLeft, headLeft, pnt2, headRight, neckRight, tailRight]; 39 | this.setCoordinates([pList]); 40 | } 41 | } -------------------------------------------------------------------------------- /dist/ol.css.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["src/ol/ol.css"],"names":[],"mappings":"AAAA,QACE,WAAY,WACZ,cAAe,IACf,OAAQ,IAAI,MAAM,KAGpB,mBACE,IAAK,IACL,MAAO,IACP,SAAU,SAGZ,eACE,WAAY,kBACZ,cAAe,IACf,OAAQ,IACR,KAAM,IACN,QAAS,IACT,SAAU,SAEZ,qBACE,OAAQ,IAAI,MAAM,KAClB,WAAY,KACZ,MAAO,KACP,UAAW,KACX,WAAY,OACZ,OAAQ,IACR,YAAa,QAAQ,CAAE,MAEzB,sBACE,YAAa,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAG9B,gBACE,QAAS,KAEG,iBAAd,aACE,sBAAuB,KACvB,oBAAqB,KACrB,iBAAkB,KAClB,gBAAiB,KACjB,YAAa,KACb,4BAA6B,YAE/B,eACE,sBAAuB,QACvB,oBAAqB,KACrB,iBAAkB,KAClB,gBAAiB,KACjB,YAAa,KAEf,aACE,OAAQ,iBACR,OAAQ,cACR,OAAQ,SAEV,SACE,OAAQ,KACR,OAAQ,aACR,OAAQ,UACR,OAAQ,KAEV,YACE,SAAU,SACV,iBAAkB,qBAClB,cAAe,IACf,QAAS,IAEX,kBACE,iBAAkB,qBAEpB,SACE,IAAK,KACL,KAAM,KAER,WACE,IAAK,KACL,MAAO,KACP,WAAY,QAAQ,KAAK,MAAM,CAAE,WAAW,GAAG,OAEjD,qBACE,QAAS,EACT,WAAY,OACZ,WAAY,QAAQ,KAAK,MAAM,CAAE,WAAW,GAAG,OAAO,KAExD,gBACE,IAAK,QACL,KAAM,KAER,gBACE,MAAO,KACP,IAAK,KAEP,aACE,YACE,QAAS,MAIb,mBACE,QAAS,MACT,OAAQ,IACR,QAAS,EACT,MAAO,KACP,UAAW,OACX,YAAa,IACb,gBAAiB,KACjB,WAAY,OACZ,OAAQ,QACR,MAAO,QACP,YAAa,KACb,iBAAkB,kBAClB,OAAQ,KACR,cAAe,IAEjB,qCACE,OAAQ,KACR,QAAS,EAEX,uBACE,YAAa,MAEf,YACE,QAAS,MACT,YAAa,IACb,UAAW,MACX,YAAa,UAEf,6BACE,UAAW,MAEb,0BACE,IAAK,MAGP,yBADA,yBAEE,gBAAiB,KACjB,iBAAkB,kBAEpB,qBACE,cAAe,IAAI,IAAI,EAAE,EAE3B,sBACE,cAAe,EAAE,EAAE,IAAI,IAIzB,gBACE,WAAY,MACZ,OAAQ,KACR,MAAO,KACP,UAAW,mBAGb,mBACE,OAAQ,EACR,QAAS,EAAE,KACX,UAAW,MACX,YAAa,QACb,MAAO,KACP,YAAa,EAAE,EAAE,IAAI,KAEvB,mBACE,QAAS,OACT,WAAY,KACZ,YAAa,QAEf,0CACE,QAAS,IAEX,oBACE,WAAY,IACZ,UAAW,QACX,eAAgB,OAEE,uBAApB,mBACE,QAAS,aAEX,gCACE,QAAS,KAEX,mCACE,WAAY,qBAEd,iCACE,OAAQ,EACR,MAAO,EACP,cAAe,IAAI,EAAE,EACrB,OAAQ,MACR,YAAa,IAEf,qCACE,WAAY,MACZ,WAAY,MAEd,wCACE,QAAS,KAGX,eACE,IAAK,MACL,KAAM,KACN,OAAQ,MAEV,sBACE,SAAU,SACV,OAAQ,KAGV,yBACE,IAAK,MAGP,gBACE,KAAM,KACN,OAAQ,KAEV,iCACE,OAAQ,EACR,KAAM,EACN,cAAe,EAAE,IAAI,EAAE,EAEzB,oCACA,uBACE,QAAS,aAEX,oCACE,OAAQ,IAAI,MAAM,QAClB,OAAQ,MACR,OAAQ,IACR,MAAO,MAET,0CACE,OAAQ,IACR,KAAM,IACN,SAAU,SAEZ,iDACA,wCACE,QAAS,KAEX,mCACE,WAAY,qBAEd,oBACE,OAAQ,IAAI,OAAO,kBAGrB,0CACE,OAAQ"} -------------------------------------------------------------------------------- /src/ol/css.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/css 3 | */ 4 | 5 | 6 | /** 7 | * The CSS class for hidden feature. 8 | * 9 | * @const 10 | * @type {string} 11 | */ 12 | export const CLASS_HIDDEN = 'ol-hidden'; 13 | 14 | 15 | /** 16 | * The CSS class that we'll give the DOM elements to have them selectable. 17 | * 18 | * @const 19 | * @type {string} 20 | */ 21 | export const CLASS_SELECTABLE = 'ol-selectable'; 22 | 23 | 24 | /** 25 | * The CSS class that we'll give the DOM elements to have them unselectable. 26 | * 27 | * @const 28 | * @type {string} 29 | */ 30 | export const CLASS_UNSELECTABLE = 'ol-unselectable'; 31 | 32 | 33 | /** 34 | * The CSS class for unsupported feature. 35 | * 36 | * @const 37 | * @type {string} 38 | */ 39 | export const CLASS_UNSUPPORTED = 'ol-unsupported'; 40 | 41 | 42 | /** 43 | * The CSS class for controls. 44 | * 45 | * @const 46 | * @type {string} 47 | */ 48 | export const CLASS_CONTROL = 'ol-control'; 49 | 50 | 51 | /** 52 | * The CSS class that we'll give the DOM elements that are collapsed, i.e. 53 | * to those elements which usually can be expanded. 54 | * 55 | * @const 56 | * @type {string} 57 | */ 58 | export const CLASS_COLLAPSED = 'ol-collapsed'; 59 | 60 | 61 | /** 62 | * Get the list of font families from a font spec. Note that this doesn't work 63 | * for font families that have commas in them. 64 | * @param {string} The CSS font property. 65 | * @return {Object } The font families (or null if the input spec is invalid). 66 | */ 67 | export const getFontFamilies = (function() { 68 | let style; 69 | const cache = {}; 70 | return function(font) { 71 | if (!style) { 72 | style = document.createElement('div').style; 73 | } 74 | if (!(font in cache)) { 75 | style.font = font; 76 | const family = style.fontFamily; 77 | style.font = ''; 78 | if (!family) { 79 | return null; 80 | } 81 | cache[font] = family.split(/,\s?/); 82 | } 83 | return cache[font]; 84 | }; 85 | })(); 86 | -------------------------------------------------------------------------------- /src/plot/plots/SquadCombat.js: -------------------------------------------------------------------------------- 1 | import PlotTypes from '../PlotTypes' 2 | import AttackArrow from './AttackArrow' 3 | import * as PlotUtils from '../utils/plot_util' 4 | import Constants from '../Constants' 5 | export default class SquadCombat extends AttackArrow { 6 | 7 | constructor(points) { 8 | super(points); 9 | this.type = PlotTypes.SQUAD_COMBAT; 10 | this.headHeightFactor = 0.18; 11 | this.headWidthFactor = 0.3; 12 | this.neckHeightFactor = 0.85; 13 | this.neckWidthFactor = 0.15; 14 | this.tailWidthFactor = 0.1; 15 | this.setPoints(points); 16 | } 17 | generate() { 18 | var count = this.getPointCount(); 19 | if (count < 2) { 20 | return; 21 | } 22 | var pnts = this.getPoints(); 23 | var tailPnts = this.getTailPoints(pnts); 24 | var headPnts = this.getArrowHeadPoints(pnts, tailPnts[0], tailPnts[1]); 25 | var neckLeft = headPnts[0]; 26 | var neckRight = headPnts[4]; 27 | var bodyPnts = this.getArrowBodyPoints(pnts, neckLeft, neckRight, this.tailWidthFactor); 28 | var count = bodyPnts.length; 29 | var leftPnts = [tailPnts[0]].concat(bodyPnts.slice(0, count / 2)); 30 | leftPnts.push(neckLeft); 31 | var rightPnts = [tailPnts[1]].concat(bodyPnts.slice(count / 2, count)); 32 | rightPnts.push(neckRight); 33 | 34 | leftPnts = PlotUtils.getQBSplinePoints(leftPnts); 35 | rightPnts = PlotUtils.getQBSplinePoints(rightPnts); 36 | 37 | this.setCoordinates([leftPnts.concat(headPnts, rightPnts.reverse())]); 38 | } 39 | 40 | getTailPoints(points) { 41 | var allLen = PlotUtils.getBaseLength(points); 42 | var tailWidth = allLen * this.tailWidthFactor; 43 | var tailLeft = PlotUtils.getThirdPoint(points[1], points[0], Constants.HALF_PI, tailWidth, false); 44 | var tailRight = PlotUtils.getThirdPoint(points[1], points[0], Constants.HALF_PI, tailWidth, true); 45 | return [tailLeft, tailRight]; 46 | }; 47 | } 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /src/ol/size.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/size 3 | */ 4 | 5 | 6 | /** 7 | * An array of numbers representing a size: `[width, height]`. 8 | * @typedef {Array } Size 9 | * @api 10 | */ 11 | 12 | 13 | /** 14 | * Returns a buffered size. 15 | * @param {Size} size Size. 16 | * @param {number} num The amount by which to buffer. 17 | * @param {Size=} opt_size Optional reusable size array. 18 | * @return {Size} The buffered size. 19 | */ 20 | export function buffer(size, num, opt_size) { 21 | if (opt_size === undefined) { 22 | opt_size = [0, 0]; 23 | } 24 | opt_size[0] = size[0] + 2 * num; 25 | opt_size[1] = size[1] + 2 * num; 26 | return opt_size; 27 | } 28 | 29 | 30 | /** 31 | * Determines if a size has a positive area. 32 | * @param {Size} size The size to test. 33 | * @return {boolean} The size has a positive area. 34 | */ 35 | export function hasArea(size) { 36 | return size[0] > 0 && size[1] > 0; 37 | } 38 | 39 | 40 | /** 41 | * Returns a size scaled by a ratio. The result will be an array of integers. 42 | * @param {Size} size Size. 43 | * @param {number} ratio Ratio. 44 | * @param {Size=} opt_size Optional reusable size array. 45 | * @return {Size} The scaled size. 46 | */ 47 | export function scale(size, ratio, opt_size) { 48 | if (opt_size === undefined) { 49 | opt_size = [0, 0]; 50 | } 51 | opt_size[0] = (size[0] * ratio + 0.5) | 0; 52 | opt_size[1] = (size[1] * ratio + 0.5) | 0; 53 | return opt_size; 54 | } 55 | 56 | 57 | /** 58 | * Returns an `Size` array for the passed in number (meaning: square) or 59 | * `Size` array. 60 | * (meaning: non-square), 61 | * @param {number|Size} size Width and height. 62 | * @param {Size=} opt_size Optional reusable size array. 63 | * @return {Size} Size. 64 | * @api 65 | */ 66 | export function toSize(size, opt_size) { 67 | if (Array.isArray(size)) { 68 | return size; 69 | } else { 70 | if (opt_size === undefined) { 71 | opt_size = [size, size]; 72 | } else { 73 | opt_size[0] = opt_size[1] = /** @type {number} */ (size); 74 | } 75 | return opt_size; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/ol/loadingstrategy.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/loadingstrategy 3 | */ 4 | 5 | 6 | /** 7 | * Strategy function for loading all features with a single request. 8 | * @param {import("./extent.js").Extent} extent Extent. 9 | * @param {number} resolution Resolution. 10 | * @return {Array } Extents. 11 | * @api 12 | */ 13 | export function all(extent, resolution) { 14 | return [[-Infinity, -Infinity, Infinity, Infinity]]; 15 | } 16 | 17 | 18 | /** 19 | * Strategy function for loading features based on the view's extent and 20 | * resolution. 21 | * @param {import("./extent.js").Extent} extent Extent. 22 | * @param {number} resolution Resolution. 23 | * @return {Array } Extents. 24 | * @api 25 | */ 26 | export function bbox(extent, resolution) { 27 | return [extent]; 28 | } 29 | 30 | 31 | /** 32 | * Creates a strategy function for loading features based on a tile grid. 33 | * @param {import("./tilegrid/TileGrid.js").default} tileGrid Tile grid. 34 | * @return {function(import("./extent.js").Extent, number): Array } Loading strategy. 35 | * @api 36 | */ 37 | export function tile(tileGrid) { 38 | return ( 39 | /** 40 | * @param {import("./extent.js").Extent} extent Extent. 41 | * @param {number} resolution Resolution. 42 | * @return {Array } Extents. 43 | */ 44 | function(extent, resolution) { 45 | const z = tileGrid.getZForResolution(resolution); 46 | const tileRange = tileGrid.getTileRangeForExtentAndZ(extent, z); 47 | /** @type {Array } */ 48 | const extents = []; 49 | /** @type {import("./tilecoord.js").TileCoord} */ 50 | const tileCoord = [z, 0, 0]; 51 | for (tileCoord[1] = tileRange.minX; tileCoord[1] <= tileRange.maxX; ++tileCoord[1]) { 52 | for (tileCoord[2] = tileRange.minY; tileCoord[2] <= tileRange.maxY; ++tileCoord[2]) { 53 | extents.push(tileGrid.getTileCoordExtent(tileCoord)); 54 | } 55 | } 56 | return extents; 57 | } 58 | ); 59 | } 60 | -------------------------------------------------------------------------------- /src/ol/interaction/DoubleClickZoom.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/interaction/DoubleClickZoom 3 | */ 4 | import MapBrowserEventType from '../MapBrowserEventType.js'; 5 | import Interaction, {zoomByDelta} from './Interaction.js'; 6 | 7 | 8 | /** 9 | * @typedef {Object} Options 10 | * @property {number} [duration=250] Animation duration in milliseconds. 11 | * @property {number} [delta=1] The zoom delta applied on each double click. 12 | */ 13 | 14 | 15 | /** 16 | * @classdesc 17 | * Allows the user to zoom by double-clicking on the map. 18 | * @api 19 | */ 20 | class DoubleClickZoom extends Interaction { 21 | 22 | /** 23 | * @param {Options=} opt_options Options. 24 | */ 25 | constructor(opt_options) { 26 | super({ 27 | handleEvent: handleEvent 28 | }); 29 | 30 | const options = opt_options ? opt_options : {}; 31 | 32 | /** 33 | * @private 34 | * @type {number} 35 | */ 36 | this.delta_ = options.delta ? options.delta : 1; 37 | 38 | /** 39 | * @private 40 | * @type {number} 41 | */ 42 | this.duration_ = options.duration !== undefined ? options.duration : 250; 43 | 44 | } 45 | 46 | } 47 | 48 | 49 | /** 50 | * Handles the {@link module:ol/MapBrowserEvent map browser event} (if it was a 51 | * doubleclick) and eventually zooms the map. 52 | * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event. 53 | * @return {boolean} `false` to stop event propagation. 54 | * @this {DoubleClickZoom} 55 | */ 56 | function handleEvent(mapBrowserEvent) { 57 | let stopEvent = false; 58 | if (mapBrowserEvent.type == MapBrowserEventType.DBLCLICK) { 59 | const browserEvent = /** @type {MouseEvent} */ (mapBrowserEvent.originalEvent); 60 | const map = mapBrowserEvent.map; 61 | const anchor = mapBrowserEvent.coordinate; 62 | const delta = browserEvent.shiftKey ? -this.delta_ : this.delta_; 63 | const view = map.getView(); 64 | zoomByDelta(view, delta, anchor, this.duration_); 65 | mapBrowserEvent.preventDefault(); 66 | stopEvent = true; 67 | } 68 | return !stopEvent; 69 | } 70 | 71 | export default DoubleClickZoom; 72 | -------------------------------------------------------------------------------- /docs/document/styles/prettify-jsdoc.css: -------------------------------------------------------------------------------- 1 | /* JSDoc prettify.js theme */ 2 | 3 | /* plain text */ 4 | .pln { 5 | color: #000000; 6 | font-weight: normal; 7 | font-style: normal; 8 | } 9 | 10 | /* string content */ 11 | .str { 12 | color: #006400; 13 | font-weight: normal; 14 | font-style: normal; 15 | } 16 | 17 | /* a keyword */ 18 | .kwd { 19 | color: #000000; 20 | font-weight: bold; 21 | font-style: normal; 22 | } 23 | 24 | /* a comment */ 25 | .com { 26 | font-weight: normal; 27 | font-style: italic; 28 | } 29 | 30 | /* a type name */ 31 | .typ { 32 | color: #000000; 33 | font-weight: normal; 34 | font-style: normal; 35 | } 36 | 37 | /* a literal value */ 38 | .lit { 39 | color: #006400; 40 | font-weight: normal; 41 | font-style: normal; 42 | } 43 | 44 | /* punctuation */ 45 | .pun { 46 | color: #000000; 47 | font-weight: bold; 48 | font-style: normal; 49 | } 50 | 51 | /* lisp open bracket */ 52 | .opn { 53 | color: #000000; 54 | font-weight: bold; 55 | font-style: normal; 56 | } 57 | 58 | /* lisp close bracket */ 59 | .clo { 60 | color: #000000; 61 | font-weight: bold; 62 | font-style: normal; 63 | } 64 | 65 | /* a markup tag name */ 66 | .tag { 67 | color: #006400; 68 | font-weight: normal; 69 | font-style: normal; 70 | } 71 | 72 | /* a markup attribute name */ 73 | .atn { 74 | color: #006400; 75 | font-weight: normal; 76 | font-style: normal; 77 | } 78 | 79 | /* a markup attribute value */ 80 | .atv { 81 | color: #006400; 82 | font-weight: normal; 83 | font-style: normal; 84 | } 85 | 86 | /* a declaration */ 87 | .dec { 88 | color: #000000; 89 | font-weight: bold; 90 | font-style: normal; 91 | } 92 | 93 | /* a variable name */ 94 | .var { 95 | color: #000000; 96 | font-weight: normal; 97 | font-style: normal; 98 | } 99 | 100 | /* a function name */ 101 | .fun { 102 | color: #000000; 103 | font-weight: bold; 104 | font-style: normal; 105 | } 106 | 107 | /* Specify class=linenums on a pre to get line numbering */ 108 | ol.linenums { 109 | margin-top: 0; 110 | margin-bottom: 0; 111 | } 112 | -------------------------------------------------------------------------------- /src/plot/plots/GatheringPlace.js: -------------------------------------------------------------------------------- 1 | import Plot from './Plot' 2 | import PlotTypes from '../PlotTypes' 3 | import PolygonOL from '../../ol/geom/Polygon' 4 | import mix from '../../util/mixin' 5 | import * as PlotUtils from '../utils/plot_util' 6 | import Constants from '../Constants' 7 | export default class GatheringPlace extends mix(Plot, PolygonOL) { 8 | 9 | constructor(points) { 10 | super(points); 11 | this.type = PlotTypes.GATHERING_PLACE; 12 | this.t = 0.4; 13 | this.fixPointCount = 3; 14 | this.setPoints(points); 15 | } 16 | generate() { 17 | var pnts = this.getPoints(); 18 | if (pnts.length < 2) { 19 | return; 20 | } 21 | if (this.getPointCount() == 2) { 22 | var mid = PlotUtils.mid(pnts[0], pnts[1]); 23 | var d = PlotUtils.distance(pnts[0], mid) / 0.9; 24 | var pnt = PlotUtils.getThirdPoint(pnts[0], mid, Constants.HALF_PI, d, true); 25 | pnts = [pnts[0], pnt, pnts[1]]; 26 | } 27 | var mid = PlotUtils.mid(pnts[0], pnts[2]); 28 | pnts.push(mid, pnts[0], pnts[1]); 29 | 30 | var normals = []; 31 | for (var i = 0; i < pnts.length - 2; i++) { 32 | var pnt1 = pnts[i]; 33 | var pnt2 = pnts[i + 1]; 34 | var pnt3 = pnts[i + 2]; 35 | var normalPoints = PlotUtils.getBisectorNormals(this.t, pnt1, pnt2, pnt3); 36 | normals = normals.concat(normalPoints); 37 | } 38 | var count = normals.length; 39 | normals = [normals[count - 1]].concat(normals.slice(0, count - 1)); 40 | var pList = []; 41 | for (i = 0; i < pnts.length - 2; i++) { 42 | pnt1 = pnts[i]; 43 | pnt2 = pnts[i + 1]; 44 | pList.push(pnt1); 45 | for (var t = 0; t <= Constants.FITTING_COUNT; t++) { 46 | var pnt = PlotUtils.getCubicValue(t / Constants.FITTING_COUNT, pnt1, normals[i * 2], normals[i * 2 + 1], pnt2); 47 | pList.push(pnt); 48 | } 49 | pList.push(pnt2); 50 | } 51 | this.setCoordinates([pList]); 52 | } 53 | 54 | 55 | } 56 | 57 | -------------------------------------------------------------------------------- /src/ol/proj/epsg4326.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/proj/epsg4326 3 | */ 4 | import Projection from './Projection.js'; 5 | import Units from './Units.js'; 6 | 7 | 8 | /** 9 | * Semi-major radius of the WGS84 ellipsoid. 10 | * 11 | * @const 12 | * @type {number} 13 | */ 14 | export const RADIUS = 6378137; 15 | 16 | 17 | /** 18 | * Extent of the EPSG:4326 projection which is the whole world. 19 | * 20 | * @const 21 | * @type {import("../extent.js").Extent} 22 | */ 23 | export const EXTENT = [-180, -90, 180, 90]; 24 | 25 | 26 | /** 27 | * @const 28 | * @type {number} 29 | */ 30 | export const METERS_PER_UNIT = Math.PI * RADIUS / 180; 31 | 32 | 33 | /** 34 | * @classdesc 35 | * Projection object for WGS84 geographic coordinates (EPSG:4326). 36 | * 37 | * Note that OpenLayers does not strictly comply with the EPSG definition. 38 | * The EPSG registry defines 4326 as a CRS for Latitude,Longitude (y,x). 39 | * OpenLayers treats EPSG:4326 as a pseudo-projection, with x,y coordinates. 40 | */ 41 | class EPSG4326Projection extends Projection { 42 | 43 | /** 44 | * @param {string} code Code. 45 | * @param {string=} opt_axisOrientation Axis orientation. 46 | */ 47 | constructor(code, opt_axisOrientation) { 48 | super({ 49 | code: code, 50 | units: Units.DEGREES, 51 | extent: EXTENT, 52 | axisOrientation: opt_axisOrientation, 53 | global: true, 54 | metersPerUnit: METERS_PER_UNIT, 55 | worldExtent: EXTENT 56 | }); 57 | 58 | } 59 | 60 | } 61 | 62 | 63 | /** 64 | * Projections equal to EPSG:4326. 65 | * 66 | * @const 67 | * @type {Array } 68 | */ 69 | export const PROJECTIONS = [ 70 | new EPSG4326Projection('CRS:84'), 71 | new EPSG4326Projection('EPSG:4326', 'neu'), 72 | new EPSG4326Projection('urn:ogc:def:crs:EPSG::4326', 'neu'), 73 | new EPSG4326Projection('urn:ogc:def:crs:EPSG:6.6:4326', 'neu'), 74 | new EPSG4326Projection('urn:ogc:def:crs:OGC:1.3:CRS84'), 75 | new EPSG4326Projection('urn:ogc:def:crs:OGC:2:84'), 76 | new EPSG4326Projection('http://www.opengis.net/gml/srs/epsg.xml#4326', 'neu'), 77 | new EPSG4326Projection('urn:x-ogc:def:crs:EPSG:4326', 'neu') 78 | ]; 79 | -------------------------------------------------------------------------------- /docs/templates/jaguarjs/static/styles/prettify-jsdoc.css: -------------------------------------------------------------------------------- 1 | /* JSDoc prettify.js theme */ 2 | 3 | /* plain text */ 4 | .pln { 5 | color: #000000; 6 | font-weight: normal; 7 | font-style: normal; 8 | } 9 | 10 | /* string content */ 11 | .str { 12 | color: #006400; 13 | font-weight: normal; 14 | font-style: normal; 15 | } 16 | 17 | /* a keyword */ 18 | .kwd { 19 | color: #000000; 20 | font-weight: bold; 21 | font-style: normal; 22 | } 23 | 24 | /* a comment */ 25 | .com { 26 | font-weight: normal; 27 | font-style: italic; 28 | } 29 | 30 | /* a type name */ 31 | .typ { 32 | color: #000000; 33 | font-weight: normal; 34 | font-style: normal; 35 | } 36 | 37 | /* a literal value */ 38 | .lit { 39 | color: #006400; 40 | font-weight: normal; 41 | font-style: normal; 42 | } 43 | 44 | /* punctuation */ 45 | .pun { 46 | color: #000000; 47 | font-weight: bold; 48 | font-style: normal; 49 | } 50 | 51 | /* lisp open bracket */ 52 | .opn { 53 | color: #000000; 54 | font-weight: bold; 55 | font-style: normal; 56 | } 57 | 58 | /* lisp close bracket */ 59 | .clo { 60 | color: #000000; 61 | font-weight: bold; 62 | font-style: normal; 63 | } 64 | 65 | /* a markup tag name */ 66 | .tag { 67 | color: #006400; 68 | font-weight: normal; 69 | font-style: normal; 70 | } 71 | 72 | /* a markup attribute name */ 73 | .atn { 74 | color: #006400; 75 | font-weight: normal; 76 | font-style: normal; 77 | } 78 | 79 | /* a markup attribute value */ 80 | .atv { 81 | color: #006400; 82 | font-weight: normal; 83 | font-style: normal; 84 | } 85 | 86 | /* a declaration */ 87 | .dec { 88 | color: #000000; 89 | font-weight: bold; 90 | font-style: normal; 91 | } 92 | 93 | /* a variable name */ 94 | .var { 95 | color: #000000; 96 | font-weight: normal; 97 | font-style: normal; 98 | } 99 | 100 | /* a function name */ 101 | .fun { 102 | color: #000000; 103 | font-weight: bold; 104 | font-style: normal; 105 | } 106 | 107 | /* Specify class=linenums on a pre to get line numbering */ 108 | ol.linenums { 109 | margin-top: 0; 110 | margin-bottom: 0; 111 | } 112 | -------------------------------------------------------------------------------- /src/ol/layer/BaseImage.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/layer/BaseImage 3 | */ 4 | import Layer from './Layer.js'; 5 | 6 | 7 | /** 8 | * @typedef {Object} Options 9 | * @property {number} [opacity=1] Opacity (0, 1). 10 | * @property {boolean} [visible=true] Visibility. 11 | * @property {import("../extent.js").Extent} [extent] The bounding extent for layer rendering. The layer will not be 12 | * rendered outside of this extent. 13 | * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers 14 | * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed 15 | * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()` 16 | * method was used. 17 | * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be 18 | * visible. 19 | * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will 20 | * be visible. 21 | * @property {import("../PluggableMap.js").default} [map] Sets the layer as overlay on a map. The map will not manage 22 | * this layer in its layers collection, and the layer will be rendered on top. This is useful for 23 | * temporary layers. The standard way to add a layer to a map and have it managed by the map is to 24 | * use {@link module:ol/Map#addLayer}. 25 | * @property {import("../source/Image.js").default} [source] Source for this layer. 26 | */ 27 | 28 | 29 | /** 30 | * @classdesc 31 | * Server-rendered images that are available for arbitrary extents and 32 | * resolutions. 33 | * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject} 34 | * property on the layer object; for example, setting `title: 'My Title'` in the 35 | * options means that `title` is observable, and has get/set accessors. 36 | * 37 | * @extends {Layer } 38 | * @api 39 | */ 40 | class BaseImageLayer extends Layer { 41 | 42 | /** 43 | * @param {Options=} opt_options Layer options. 44 | */ 45 | constructor(opt_options) { 46 | const options = opt_options ? opt_options : {}; 47 | super(options); 48 | } 49 | 50 | } 51 | 52 | export default BaseImageLayer; 53 | -------------------------------------------------------------------------------- /src/ol/ImageBase.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/ImageBase 3 | */ 4 | import {abstract} from './util.js'; 5 | import EventTarget from './events/Target.js'; 6 | import EventType from './events/EventType.js'; 7 | 8 | /** 9 | * @abstract 10 | */ 11 | class ImageBase extends EventTarget { 12 | 13 | /** 14 | * @param {import("./extent.js").Extent} extent Extent. 15 | * @param {number|undefined} resolution Resolution. 16 | * @param {number} pixelRatio Pixel ratio. 17 | * @param {import("./ImageState.js").default} state State. 18 | */ 19 | constructor(extent, resolution, pixelRatio, state) { 20 | 21 | super(); 22 | 23 | /** 24 | * @protected 25 | * @type {import("./extent.js").Extent} 26 | */ 27 | this.extent = extent; 28 | 29 | /** 30 | * @private 31 | * @type {number} 32 | */ 33 | this.pixelRatio_ = pixelRatio; 34 | 35 | /** 36 | * @protected 37 | * @type {number|undefined} 38 | */ 39 | this.resolution = resolution; 40 | 41 | /** 42 | * @protected 43 | * @type {import("./ImageState.js").default} 44 | */ 45 | this.state = state; 46 | 47 | } 48 | 49 | /** 50 | * @protected 51 | */ 52 | changed() { 53 | this.dispatchEvent(EventType.CHANGE); 54 | } 55 | 56 | /** 57 | * @return {import("./extent.js").Extent} Extent. 58 | */ 59 | getExtent() { 60 | return this.extent; 61 | } 62 | 63 | /** 64 | * @abstract 65 | * @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image. 66 | */ 67 | getImage() { 68 | return abstract(); 69 | } 70 | 71 | /** 72 | * @return {number} PixelRatio. 73 | */ 74 | getPixelRatio() { 75 | return this.pixelRatio_; 76 | } 77 | 78 | /** 79 | * @return {number} Resolution. 80 | */ 81 | getResolution() { 82 | return /** @type {number} */ (this.resolution); 83 | } 84 | 85 | /** 86 | * @return {import("./ImageState.js").default} State. 87 | */ 88 | getState() { 89 | return this.state; 90 | } 91 | 92 | /** 93 | * Load not yet loaded URI. 94 | * @abstract 95 | */ 96 | load() { 97 | abstract(); 98 | } 99 | } 100 | 101 | 102 | export default ImageBase; 103 | -------------------------------------------------------------------------------- /src/ol/obj.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/obj 3 | */ 4 | 5 | 6 | /** 7 | * Polyfill for Object.assign(). Assigns enumerable and own properties from 8 | * one or more source objects to a target object. 9 | * See https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign. 10 | * 11 | * @param {!Object} target The target object. 12 | * @param {...Object} var_sources The source object(s). 13 | * @return {!Object} The modified target object. 14 | */ 15 | export const assign = (typeof Object.assign === 'function') ? Object.assign : function(target, var_sources) { 16 | if (target === undefined || target === null) { 17 | throw new TypeError('Cannot convert undefined or null to object'); 18 | } 19 | 20 | const output = Object(target); 21 | for (let i = 1, ii = arguments.length; i < ii; ++i) { 22 | const source = arguments[i]; 23 | if (source !== undefined && source !== null) { 24 | for (const key in source) { 25 | if (source.hasOwnProperty(key)) { 26 | output[key] = source[key]; 27 | } 28 | } 29 | } 30 | } 31 | return output; 32 | }; 33 | 34 | 35 | /** 36 | * Removes all properties from an object. 37 | * @param {Object} object The object to clear. 38 | */ 39 | export function clear(object) { 40 | for (const property in object) { 41 | delete object[property]; 42 | } 43 | } 44 | 45 | 46 | /** 47 | * Polyfill for Object.values(). Get an array of property values from an object. 48 | * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/values 49 | * 50 | * @param {!Object } object The object from which to get the values. 51 | * @return {!Array } The property values. 52 | * @template K,V 53 | */ 54 | export const getValues = (typeof Object.values === 'function') ? Object.values : function(object) { 55 | const values = []; 56 | for (const property in object) { 57 | values.push(object[property]); 58 | } 59 | return values; 60 | }; 61 | 62 | 63 | /** 64 | * Determine if an object has any properties. 65 | * @param {Object} object The object to check. 66 | * @return {boolean} The object is empty. 67 | */ 68 | export function isEmpty(object) { 69 | let property; 70 | for (property in object) { 71 | return false; 72 | } 73 | return !property; 74 | } 75 | -------------------------------------------------------------------------------- /src/plot/plots/TailedSquadCombat.js: -------------------------------------------------------------------------------- 1 | import PlotTypes from '../PlotTypes' 2 | import AttackArrow from './AttackArrow' 3 | import * as PlotUtils from '../utils/plot_util' 4 | import Constants from '../Constants' 5 | export default class TailedSquadCombat extends AttackArrow { 6 | 7 | constructor(points) { 8 | super(points); 9 | this.type = PlotTypes.TAILED_SQUAD_COMBAT; 10 | this.headHeightFactor = 0.18; 11 | this.headWidthFactor = 0.3; 12 | this.neckHeightFactor = 0.85; 13 | this.neckWidthFactor = 0.15; 14 | this.tailWidthFactor = 0.1; 15 | this.swallowTailFactor = 1; 16 | this.swallowTailPnt = null; 17 | this.setPoints(points); 18 | } 19 | generate() { 20 | var count = this.getPointCount(); 21 | if (count < 2) { 22 | return; 23 | } 24 | var pnts = this.getPoints(); 25 | var tailPnts = this.getTailPoints(pnts); 26 | var headPnts = this.getArrowHeadPoints(pnts, tailPnts[0], tailPnts[2]); 27 | var neckLeft = headPnts[0]; 28 | var neckRight = headPnts[4]; 29 | var bodyPnts = this.getArrowBodyPoints(pnts, neckLeft, neckRight, this.tailWidthFactor); 30 | var count = bodyPnts.length; 31 | var leftPnts = [tailPnts[0]].concat(bodyPnts.slice(0, count / 2)); 32 | leftPnts.push(neckLeft); 33 | var rightPnts = [tailPnts[2]].concat(bodyPnts.slice(count / 2, count)); 34 | rightPnts.push(neckRight); 35 | 36 | leftPnts = PlotUtils.getQBSplinePoints(leftPnts); 37 | rightPnts = PlotUtils.getQBSplinePoints(rightPnts); 38 | 39 | this.setCoordinates([leftPnts.concat(headPnts, rightPnts.reverse(), [tailPnts[1], leftPnts[0]])]); 40 | } 41 | 42 | getTailPoints(points) { 43 | var allLen = PlotUtils.getBaseLength(points); 44 | var tailWidth = allLen * this.tailWidthFactor; 45 | var tailLeft = PlotUtils.getThirdPoint(points[1], points[0], Constants.HALF_PI, tailWidth, false); 46 | var tailRight = PlotUtils.getThirdPoint(points[1], points[0], Constants.HALF_PI, tailWidth, true); 47 | var len = tailWidth * this.swallowTailFactor; 48 | var swallowTailPnt = PlotUtils.getThirdPoint(points[1], points[0], 0, len, true); 49 | return [tailLeft, swallowTailPnt, tailRight]; 50 | }; 51 | 52 | 53 | } 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /src/ol/rotationconstraint.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/rotationconstraint 3 | */ 4 | import {toRadians} from './math.js'; 5 | 6 | 7 | /** 8 | * @typedef {function((number|undefined), boolean=): (number|undefined)} Type 9 | */ 10 | 11 | 12 | /** 13 | * @param {number|undefined} rotation Rotation. 14 | * @return {number|undefined} Rotation. 15 | */ 16 | export function disable(rotation) { 17 | if (rotation !== undefined) { 18 | return 0; 19 | } else { 20 | return undefined; 21 | } 22 | } 23 | 24 | 25 | /** 26 | * @param {number|undefined} rotation Rotation. 27 | * @return {number|undefined} Rotation. 28 | */ 29 | export function none(rotation) { 30 | if (rotation !== undefined) { 31 | return rotation; 32 | } else { 33 | return undefined; 34 | } 35 | } 36 | 37 | 38 | /** 39 | * @param {number} n N. 40 | * @return {Type} Rotation constraint. 41 | */ 42 | export function createSnapToN(n) { 43 | const theta = 2 * Math.PI / n; 44 | return ( 45 | /** 46 | * @param {number|undefined} rotation Rotation. 47 | * @param {boolean=} opt_isMoving True if an interaction or animation is in progress. 48 | * @return {number|undefined} Rotation. 49 | */ 50 | function(rotation, opt_isMoving) { 51 | if (opt_isMoving) { 52 | return rotation; 53 | } 54 | 55 | if (rotation !== undefined) { 56 | rotation = Math.floor(rotation / theta + 0.5) * theta; 57 | return rotation; 58 | } else { 59 | return undefined; 60 | } 61 | }); 62 | } 63 | 64 | 65 | /** 66 | * @param {number=} opt_tolerance Tolerance. 67 | * @return {Type} Rotation constraint. 68 | */ 69 | export function createSnapToZero(opt_tolerance) { 70 | const tolerance = opt_tolerance || toRadians(5); 71 | return ( 72 | /** 73 | * @param {number|undefined} rotation Rotation. 74 | * @param {boolean} opt_isMoving True if an interaction or animation is in progress. 75 | * @return {number|undefined} Rotation. 76 | */ 77 | function(rotation, opt_isMoving) { 78 | if (opt_isMoving) { 79 | return rotation; 80 | } 81 | 82 | if (rotation !== undefined) { 83 | if (Math.abs(rotation) <= tolerance) { 84 | return 0; 85 | } else { 86 | return rotation; 87 | } 88 | } else { 89 | return undefined; 90 | } 91 | }); 92 | } 93 | -------------------------------------------------------------------------------- /src/ol/MapBrowserEvent.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/MapBrowserEvent 3 | */ 4 | import MapEvent from './MapEvent.js'; 5 | 6 | /** 7 | * @classdesc 8 | * Events emitted as map browser events are instances of this type. 9 | * See {@link module:ol/PluggableMap~PluggableMap} for which events trigger a map browser event. 10 | */ 11 | class MapBrowserEvent extends MapEvent { 12 | 13 | /** 14 | * @param {string} type Event type. 15 | * @param {import("./PluggableMap.js").default} map Map. 16 | * @param {Event} browserEvent Browser event. 17 | * @param {boolean=} opt_dragging Is the map currently being dragged? 18 | * @param {?import("./PluggableMap.js").FrameState=} opt_frameState Frame state. 19 | */ 20 | constructor(type, map, browserEvent, opt_dragging, opt_frameState) { 21 | 22 | super(type, map, opt_frameState); 23 | 24 | /** 25 | * The original browser event. 26 | * @const 27 | * @type {Event} 28 | * @api 29 | */ 30 | this.originalEvent = browserEvent; 31 | 32 | /** 33 | * The map pixel relative to the viewport corresponding to the original browser event. 34 | * @type {import("./pixel.js").Pixel} 35 | * @api 36 | */ 37 | this.pixel = map.getEventPixel(browserEvent); 38 | 39 | /** 40 | * The coordinate in view projection corresponding to the original browser event. 41 | * @type {import("./coordinate.js").Coordinate} 42 | * @api 43 | */ 44 | this.coordinate = map.getCoordinateFromPixel(this.pixel); 45 | 46 | /** 47 | * Indicates if the map is currently being dragged. Only set for 48 | * `POINTERDRAG` and `POINTERMOVE` events. Default is `false`. 49 | * 50 | * @type {boolean} 51 | * @api 52 | */ 53 | this.dragging = opt_dragging !== undefined ? opt_dragging : false; 54 | 55 | } 56 | 57 | /** 58 | * Prevents the default browser action. 59 | * See https://developer.mozilla.org/en-US/docs/Web/API/event.preventDefault. 60 | * @override 61 | * @api 62 | */ 63 | preventDefault() { 64 | super.preventDefault(); 65 | this.originalEvent.preventDefault(); 66 | } 67 | 68 | /** 69 | * Prevents further propagation of the current event. 70 | * See https://developer.mozilla.org/en-US/docs/Web/API/event.stopPropagation. 71 | * @override 72 | * @api 73 | */ 74 | stopPropagation() { 75 | super.stopPropagation(); 76 | this.originalEvent.stopPropagation(); 77 | } 78 | } 79 | 80 | 81 | export default MapBrowserEvent; 82 | -------------------------------------------------------------------------------- /src/ol/proj/transforms.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/proj/transforms 3 | */ 4 | import {isEmpty} from '../obj.js'; 5 | 6 | 7 | /** 8 | * @private 9 | * @type {!Object >} 10 | */ 11 | let transforms = {}; 12 | 13 | 14 | /** 15 | * Clear the transform cache. 16 | */ 17 | export function clear() { 18 | transforms = {}; 19 | } 20 | 21 | 22 | /** 23 | * Registers a conversion function to convert coordinates from the source 24 | * projection to the destination projection. 25 | * 26 | * @param {import("./Projection.js").default} source Source. 27 | * @param {import("./Projection.js").default} destination Destination. 28 | * @param {import("../proj.js").TransformFunction} transformFn Transform. 29 | */ 30 | export function add(source, destination, transformFn) { 31 | const sourceCode = source.getCode(); 32 | const destinationCode = destination.getCode(); 33 | if (!(sourceCode in transforms)) { 34 | transforms[sourceCode] = {}; 35 | } 36 | transforms[sourceCode][destinationCode] = transformFn; 37 | } 38 | 39 | 40 | /** 41 | * Unregisters the conversion function to convert coordinates from the source 42 | * projection to the destination projection. This method is used to clean up 43 | * cached transforms during testing. 44 | * 45 | * @param {import("./Projection.js").default} source Source projection. 46 | * @param {import("./Projection.js").default} destination Destination projection. 47 | * @return {import("../proj.js").TransformFunction} transformFn The unregistered transform. 48 | */ 49 | export function remove(source, destination) { 50 | const sourceCode = source.getCode(); 51 | const destinationCode = destination.getCode(); 52 | const transform = transforms[sourceCode][destinationCode]; 53 | delete transforms[sourceCode][destinationCode]; 54 | if (isEmpty(transforms[sourceCode])) { 55 | delete transforms[sourceCode]; 56 | } 57 | return transform; 58 | } 59 | 60 | 61 | /** 62 | * Get a transform given a source code and a destination code. 63 | * @param {string} sourceCode The code for the source projection. 64 | * @param {string} destinationCode The code for the destination projection. 65 | * @return {import("../proj.js").TransformFunction|undefined} The transform function (if found). 66 | */ 67 | export function get(sourceCode, destinationCode) { 68 | let transform; 69 | if (sourceCode in transforms && destinationCode in transforms[sourceCode]) { 70 | transform = transforms[sourceCode][destinationCode]; 71 | } 72 | return transform; 73 | } 74 | -------------------------------------------------------------------------------- /src/ol/tilecoord.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/tilecoord 3 | */ 4 | 5 | 6 | /** 7 | * An array of three numbers representing the location of a tile in a tile 8 | * grid. The order is `z` (zoom level), `x` (column), and `y` (row). 9 | * @typedef {Array } TileCoord 10 | * @api 11 | */ 12 | 13 | 14 | /** 15 | * @param {number} z Z. 16 | * @param {number} x X. 17 | * @param {number} y Y. 18 | * @param {TileCoord=} opt_tileCoord Tile coordinate. 19 | * @return {TileCoord} Tile coordinate. 20 | */ 21 | export function createOrUpdate(z, x, y, opt_tileCoord) { 22 | if (opt_tileCoord !== undefined) { 23 | opt_tileCoord[0] = z; 24 | opt_tileCoord[1] = x; 25 | opt_tileCoord[2] = y; 26 | return opt_tileCoord; 27 | } else { 28 | return [z, x, y]; 29 | } 30 | } 31 | 32 | 33 | /** 34 | * @param {number} z Z. 35 | * @param {number} x X. 36 | * @param {number} y Y. 37 | * @return {string} Key. 38 | */ 39 | export function getKeyZXY(z, x, y) { 40 | return z + '/' + x + '/' + y; 41 | } 42 | 43 | 44 | /** 45 | * Get the key for a tile coord. 46 | * @param {TileCoord} tileCoord The tile coord. 47 | * @return {string} Key. 48 | */ 49 | export function getKey(tileCoord) { 50 | return getKeyZXY(tileCoord[0], tileCoord[1], tileCoord[2]); 51 | } 52 | 53 | 54 | /** 55 | * Get a tile coord given a key. 56 | * @param {string} key The tile coord key. 57 | * @return {TileCoord} The tile coord. 58 | */ 59 | export function fromKey(key) { 60 | return key.split('/').map(Number); 61 | } 62 | 63 | 64 | /** 65 | * @param {TileCoord} tileCoord Tile coord. 66 | * @return {number} Hash. 67 | */ 68 | export function hash(tileCoord) { 69 | return (tileCoord[1] << tileCoord[0]) + tileCoord[2]; 70 | } 71 | 72 | 73 | /** 74 | * @param {TileCoord} tileCoord Tile coordinate. 75 | * @param {!import("./tilegrid/TileGrid.js").default} tileGrid Tile grid. 76 | * @return {boolean} Tile coordinate is within extent and zoom level range. 77 | */ 78 | export function withinExtentAndZ(tileCoord, tileGrid) { 79 | const z = tileCoord[0]; 80 | const x = tileCoord[1]; 81 | const y = tileCoord[2]; 82 | 83 | if (tileGrid.getMinZoom() > z || z > tileGrid.getMaxZoom()) { 84 | return false; 85 | } 86 | const extent = tileGrid.getExtent(); 87 | let tileRange; 88 | if (!extent) { 89 | tileRange = tileGrid.getFullTileRange(z); 90 | } else { 91 | tileRange = tileGrid.getTileRangeForExtentAndZ(extent, z); 92 | } 93 | if (!tileRange) { 94 | return true; 95 | } else { 96 | return tileRange.containsXY(x, y); 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /src/ol/ImageCanvas.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/ImageCanvas 3 | */ 4 | import ImageBase from './ImageBase.js'; 5 | import ImageState from './ImageState.js'; 6 | 7 | 8 | /** 9 | * A function that is called to trigger asynchronous canvas drawing. It is 10 | * called with a "done" callback that should be called when drawing is done. 11 | * If any error occurs during drawing, the "done" callback should be called with 12 | * that error. 13 | * 14 | * @typedef {function(function(Error=): void): void} Loader 15 | */ 16 | 17 | 18 | class ImageCanvas extends ImageBase { 19 | 20 | /** 21 | * @param {import("./extent.js").Extent} extent Extent. 22 | * @param {number} resolution Resolution. 23 | * @param {number} pixelRatio Pixel ratio. 24 | * @param {HTMLCanvasElement} canvas Canvas. 25 | * @param {Loader=} opt_loader Optional loader function to 26 | * support asynchronous canvas drawing. 27 | */ 28 | constructor(extent, resolution, pixelRatio, canvas, opt_loader) { 29 | 30 | const state = opt_loader !== undefined ? ImageState.IDLE : ImageState.LOADED; 31 | 32 | super(extent, resolution, pixelRatio, state); 33 | 34 | /** 35 | * Optional canvas loader function. 36 | * @type {?Loader} 37 | * @private 38 | */ 39 | this.loader_ = opt_loader !== undefined ? opt_loader : null; 40 | 41 | /** 42 | * @private 43 | * @type {HTMLCanvasElement} 44 | */ 45 | this.canvas_ = canvas; 46 | 47 | /** 48 | * @private 49 | * @type {Error} 50 | */ 51 | this.error_ = null; 52 | 53 | } 54 | 55 | /** 56 | * Get any error associated with asynchronous rendering. 57 | * @return {Error} Any error that occurred during rendering. 58 | */ 59 | getError() { 60 | return this.error_; 61 | } 62 | 63 | /** 64 | * Handle async drawing complete. 65 | * @param {Error=} err Any error during drawing. 66 | * @private 67 | */ 68 | handleLoad_(err) { 69 | if (err) { 70 | this.error_ = err; 71 | this.state = ImageState.ERROR; 72 | } else { 73 | this.state = ImageState.LOADED; 74 | } 75 | this.changed(); 76 | } 77 | 78 | /** 79 | * @inheritDoc 80 | */ 81 | load() { 82 | if (this.state == ImageState.IDLE) { 83 | this.state = ImageState.LOADING; 84 | this.changed(); 85 | this.loader_(this.handleLoad_.bind(this)); 86 | } 87 | } 88 | 89 | /** 90 | * @return {HTMLCanvasElement} Canvas element. 91 | */ 92 | getImage() { 93 | return this.canvas_; 94 | } 95 | } 96 | 97 | 98 | export default ImageCanvas; 99 | -------------------------------------------------------------------------------- /src/plot/plots/TailedAttackArrow.js: -------------------------------------------------------------------------------- 1 | import PlotTypes from '../PlotTypes' 2 | import AttackArrow from './AttackArrow' 3 | import * as PlotUtils from '../utils/plot_util' 4 | import Constants from '../Constants' 5 | export default class TailedAttackArrow extends AttackArrow { 6 | 7 | constructor(points) { 8 | super(points); 9 | this.type = PlotTypes.TAILED_ATTACK_ARROW; 10 | this.headHeightFactor = 0.18; 11 | this.headWidthFactor = 0.3; 12 | this.neckHeightFactor = 0.85; 13 | this.neckWidthFactor = 0.15; 14 | this.tailWidthFactor = 0.1; 15 | this.headTailFactor = 0.8; 16 | this.swallowTailFactor = 1; 17 | this.swallowTailPnt = null; 18 | this.setPoints(points); 19 | } 20 | generate() { 21 | var count = this.getPointCount(); 22 | if (count < 2) { 23 | return; 24 | } 25 | if (this.getPointCount() == 2) { 26 | this.setCoordinates([this.points]); 27 | return; 28 | } 29 | var pnts = this.getPoints(); 30 | var tailLeft = pnts[0]; 31 | var tailRight = pnts[1]; 32 | if (PlotUtils.isClockWise(pnts[0], pnts[1], pnts[2])) { 33 | tailLeft = pnts[1]; 34 | tailRight = pnts[0]; 35 | } 36 | var midTail = PlotUtils.mid(tailLeft, tailRight); 37 | var bonePnts = [midTail].concat(pnts.slice(2)); 38 | var headPnts = this.getArrowHeadPoints(bonePnts, tailLeft, tailRight); 39 | var neckLeft = headPnts[0]; 40 | var neckRight = headPnts[4]; 41 | var tailWidth = PlotUtils.distance(tailLeft, tailRight); 42 | var allLen = PlotUtils.getBaseLength(bonePnts); 43 | var len = allLen * this.tailWidthFactor * this.swallowTailFactor; 44 | this.swallowTailPnt = PlotUtils.getThirdPoint(bonePnts[1], bonePnts[0], 0, len, true); 45 | var factor = tailWidth / allLen; 46 | var bodyPnts = this.getArrowBodyPoints(bonePnts, neckLeft, neckRight, factor); 47 | var count = bodyPnts.length; 48 | var leftPnts = [tailLeft].concat(bodyPnts.slice(0, count / 2)); 49 | leftPnts.push(neckLeft); 50 | var rightPnts = [tailRight].concat(bodyPnts.slice(count / 2, count)); 51 | rightPnts.push(neckRight); 52 | 53 | leftPnts = PlotUtils.getQBSplinePoints(leftPnts); 54 | rightPnts = PlotUtils.getQBSplinePoints(rightPnts); 55 | 56 | this.setCoordinates([leftPnts.concat(headPnts, rightPnts.reverse(), [this.swallowTailPnt, leftPnts[0]])]); 57 | } 58 | 59 | 60 | } 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /docs/document/scripts/main.js: -------------------------------------------------------------------------------- 1 | $(function () { 2 | // Search Items 3 | $('#search').on('keyup', function (e) { 4 | var value = $(this).val(); 5 | var $el = $('.navigation'); 6 | 7 | if (value) { 8 | var regexp = new RegExp(value, 'i'); 9 | $el.find('li, .itemMembers').hide(); 10 | 11 | $el.find('li').each(function (i, v) { 12 | var $item = $(v); 13 | 14 | if ($item.data('name') && regexp.test($item.data('name'))) { 15 | $item.show(); 16 | $item.closest('.itemMembers').show(); 17 | $item.closest('.item').show(); 18 | } 19 | }); 20 | } else { 21 | $el.find('.item, .itemMembers').show(); 22 | } 23 | 24 | $el.find('.list').scrollTop(0); 25 | }); 26 | 27 | // Toggle when click an item element 28 | $('.navigation').on('click', '.title', function (e) { 29 | $(this).parent().find('.itemMembers').toggle(); 30 | }); 31 | 32 | // Show an item related a current documentation automatically 33 | var filename = $('.page-title').data('filename').replace(/\.[a-z]+$/, ''); 34 | var $currentItem = $('.navigation .item[data-name*="' + filename + '"]:eq(0)'); 35 | 36 | if ($currentItem.length) { 37 | $currentItem 38 | .remove() 39 | .prependTo('.navigation .list') 40 | .show() 41 | .find('.itemMembers') 42 | .show(); 43 | } 44 | 45 | // Auto resizing on navigation 46 | var _onResize = function () { 47 | var height = $(window).height(); 48 | var $el = $('.navigation'); 49 | 50 | $el.height(height).find('.list').height(height - 133); 51 | }; 52 | 53 | $(window).on('resize', _onResize); 54 | _onResize(); 55 | 56 | // disqus code 57 | if (config.disqus) { 58 | $(window).on('load', function () { 59 | var disqus_shortname = config.disqus; // required: replace example with your forum shortname 60 | var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; 61 | dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js'; 62 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); 63 | var s = document.createElement('script'); s.async = true; 64 | s.type = 'text/javascript'; 65 | s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; 66 | document.getElementsByTagName('BODY')[0].appendChild(s); 67 | }); 68 | } 69 | }); -------------------------------------------------------------------------------- /src/ol/geom/flat/inflate.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module ol/geom/flat/inflate 3 | */ 4 | 5 | 6 | /** 7 | * @param {Array } flatCoordinates Flat coordinates. 8 | * @param {number} offset Offset. 9 | * @param {number} end End. 10 | * @param {number} stride Stride. 11 | * @param {Array =} opt_coordinates Coordinates. 12 | * @return {Array } Coordinates. 13 | */ 14 | export function inflateCoordinates(flatCoordinates, offset, end, stride, opt_coordinates) { 15 | const coordinates = opt_coordinates !== undefined ? opt_coordinates : []; 16 | let i = 0; 17 | for (let j = offset; j < end; j += stride) { 18 | coordinates[i++] = flatCoordinates.slice(j, j + stride); 19 | } 20 | coordinates.length = i; 21 | return coordinates; 22 | } 23 | 24 | 25 | /** 26 | * @param {Array } flatCoordinates Flat coordinates. 27 | * @param {number} offset Offset. 28 | * @param {Array } ends Ends. 29 | * @param {number} stride Stride. 30 | * @param {Array >=} opt_coordinatess Coordinatess. 31 | * @return {Array >} Coordinatess. 32 | */ 33 | export function inflateCoordinatesArray(flatCoordinates, offset, ends, stride, opt_coordinatess) { 34 | const coordinatess = opt_coordinatess !== undefined ? opt_coordinatess : []; 35 | let i = 0; 36 | for (let j = 0, jj = ends.length; j < jj; ++j) { 37 | const end = ends[j]; 38 | coordinatess[i++] = inflateCoordinates( 39 | flatCoordinates, offset, end, stride, coordinatess[i]); 40 | offset = end; 41 | } 42 | coordinatess.length = i; 43 | return coordinatess; 44 | } 45 | 46 | 47 | /** 48 | * @param {Array } flatCoordinates Flat coordinates. 49 | * @param {number} offset Offset. 50 | * @param {Array >} endss Endss. 51 | * @param {number} stride Stride. 52 | * @param {Array >>=} opt_coordinatesss 53 | * Coordinatesss. 54 | * @return {Array >>} Coordinatesss. 55 | */ 56 | export function inflateMultiCoordinatesArray(flatCoordinates, offset, endss, stride, opt_coordinatesss) { 57 | const coordinatesss = opt_coordinatesss !== undefined ? opt_coordinatesss : []; 58 | let i = 0; 59 | for (let j = 0, jj = endss.length; j < jj; ++j) { 60 | const ends = endss[j]; 61 | coordinatesss[i++] = inflateCoordinatesArray( 62 | flatCoordinates, offset, ends, stride, coordinatesss[i]); 63 | offset = ends[ends.length - 1]; 64 | } 65 | coordinatesss.length = i; 66 | return coordinatesss; 67 | } 68 | -------------------------------------------------------------------------------- /docs/templates/jaguarjs/static/scripts/main.js: -------------------------------------------------------------------------------- 1 | $(function () { 2 | // Search Items 3 | $('#search').on('keyup', function (e) { 4 | var value = $(this).val(); 5 | var $el = $('.navigation'); 6 | 7 | if (value) { 8 | var regexp = new RegExp(value, 'i'); 9 | $el.find('li, .itemMembers').hide(); 10 | 11 | $el.find('li').each(function (i, v) { 12 | var $item = $(v); 13 | 14 | if ($item.data('name') && regexp.test($item.data('name'))) { 15 | $item.show(); 16 | $item.closest('.itemMembers').show(); 17 | $item.closest('.item').show(); 18 | } 19 | }); 20 | } else { 21 | $el.find('.item, .itemMembers').show(); 22 | } 23 | 24 | $el.find('.list').scrollTop(0); 25 | }); 26 | 27 | // Toggle when click an item element 28 | $('.navigation').on('click', '.title', function (e) { 29 | $(this).parent().find('.itemMembers').toggle(); 30 | }); 31 | 32 | // Show an item related a current documentation automatically 33 | var filename = $('.page-title').data('filename').replace(/\.[a-z]+$/, ''); 34 | var $currentItem = $('.navigation .item[data-name*="' + filename + '"]:eq(0)'); 35 | 36 | if ($currentItem.length) { 37 | $currentItem 38 | .remove() 39 | .prependTo('.navigation .list') 40 | .show() 41 | .find('.itemMembers') 42 | .show(); 43 | } 44 | 45 | // Auto resizing on navigation 46 | var _onResize = function () { 47 | var height = $(window).height(); 48 | var $el = $('.navigation'); 49 | 50 | $el.height(height).find('.list').height(height - 133); 51 | }; 52 | 53 | $(window).on('resize', _onResize); 54 | _onResize(); 55 | 56 | // disqus code 57 | if (config.disqus) { 58 | $(window).on('load', function () { 59 | var disqus_shortname = config.disqus; // required: replace example with your forum shortname 60 | var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; 61 | dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js'; 62 | (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); 63 | var s = document.createElement('script'); s.async = true; 64 | s.type = 'text/javascript'; 65 | s.src = 'http://' + disqus_shortname + '.disqus.com/count.js'; 66 | document.getElementsByTagName('BODY')[0].appendChild(s); 67 | }); 68 | } 69 | }); -------------------------------------------------------------------------------- /docs/document/styles/prettify-tomorrow.css: -------------------------------------------------------------------------------- 1 | /* Tomorrow Theme */ 2 | /* Original theme - https://github.com/chriskempson/tomorrow-theme */ 3 | /* Pretty printing styles. Used with prettify.js. */ 4 | /* SPAN elements with the classes below are added by prettyprint. */ 5 | /* plain text */ 6 | .pln { 7 | color: #4d4d4c; } 8 | 9 | @media screen { 10 | /* string content */ 11 | .str { 12 | color: #718c00; } 13 | 14 | /* a keyword */ 15 | .kwd { 16 | color: #8959a8; } 17 | 18 | /* a comment */ 19 | .com { 20 | color: #8e908c; } 21 | 22 | /* a type name */ 23 | .typ { 24 | color: #4271ae; } 25 | 26 | /* a literal value */ 27 | .lit { 28 | color: #f5871f; } 29 | 30 | /* punctuation */ 31 | .pun { 32 | color: #4d4d4c; } 33 | 34 | /* lisp open bracket */ 35 | .opn { 36 | color: #4d4d4c; } 37 | 38 | /* lisp close bracket */ 39 | .clo { 40 | color: #4d4d4c; } 41 | 42 | /* a markup tag name */ 43 | .tag { 44 | color: #c82829; } 45 | 46 | /* a markup attribute name */ 47 | .atn { 48 | color: #f5871f; } 49 | 50 | /* a markup attribute value */ 51 | .atv { 52 | color: #3e999f; } 53 | 54 | /* a declaration */ 55 | .dec { 56 | color: #f5871f; } 57 | 58 | /* a variable name */ 59 | .var { 60 | color: #c82829; } 61 | 62 | /* a function name */ 63 | .fun { 64 | color: #4271ae; } } 65 | /* Use higher contrast and text-weight for printable form. */ 66 | @media print, projection { 67 | .str { 68 | color: #060; } 69 | 70 | .kwd { 71 | color: #006; 72 | font-weight: bold; } 73 | 74 | .com { 75 | color: #600; 76 | font-style: italic; } 77 | 78 | .typ { 79 | color: #404; 80 | font-weight: bold; } 81 | 82 | .lit { 83 | color: #044; } 84 | 85 | .pun, .opn, .clo { 86 | color: #440; } 87 | 88 | .tag { 89 | color: #006; 90 | font-weight: bold; } 91 | 92 | .atn { 93 | color: #404; } 94 | 95 | .atv { 96 | color: #060; } } 97 | /* Style */ 98 | /* 99 | pre.prettyprint { 100 | background: white; 101 | font-family: Menlo, Monaco, Consolas, monospace; 102 | font-size: 12px; 103 | line-height: 1.5; 104 | border: 1px solid #ccc; 105 | padding: 10px; } 106 | */ 107 | 108 | /* Specify class=linenums on a pre to get line numbering */ 109 | ol.linenums { 110 | margin-top: 0; 111 | margin-bottom: 0; } 112 | 113 | /* IE indents via margin-left */ 114 | li.L0, 115 | li.L1, 116 | li.L2, 117 | li.L3, 118 | li.L4, 119 | li.L5, 120 | li.L6, 121 | li.L7, 122 | li.L8, 123 | li.L9 { 124 | /* */ } 125 | 126 | /* Alternate shading for lines */ 127 | li.L1, 128 | li.L3, 129 | li.L5, 130 | li.L7, 131 | li.L9 { 132 | /* */ } 133 | --------------------------------------------------------------------------------