API Docs for: 0.1.0
Show:

File: src\PtvMercator.js

/**
 @module L.CRS
 **/

/**
 Provides the PTV Mercator coordinate reference system.
 @class L.CRS.PTVMercator
 @constructor
 **/
L.CRS.PTVMercator = L.extend({}, L.CRS, {
  /**
   Standard code name of the CRS passed into WMS services.
   @property code
   @type String
   @default "PTV:MERCATOR"
   @readOnly
   **/
  code: 'PTV:MERCATOR',

  /**
   Projection that this CRS uses.
   @property projection
   @type L.IProjection
   @readOnly
   **/
  projection: L.Projection.SphericalMercator,

  /**
   Transformation that this CRS uses to turn projected coordinates into screen coordinates for a particular tile service.
   @property transformation
   @type L.Transformation
   @readOnly
   **/
  transformation: new L.Transformation(0.5 / Math.PI, 0.5, -0.5 / Math.PI, 0.5),

  /**
   The earth radius used for projections.
   @property earthRadius
   @type Number
   @default 6371000
   @private
   **/
  _earthRadius: 6371000,

  /**
   Projects a geographical coordinate into a PTV Mercator point.
   @method project
   @return {Point} PTV Mercator point.
   **/
  project: function(latlng) {
    var projectedPoint = this.projection.project(latlng);
    return projectedPoint.multiplyBy(this._earthRadius);
  },

  /**
   Unprojects a PTV Mercator point to a geographical coordinate.
   @method unproject
   @return {L.LatLng} Geographical coordinate.
   **/
  unproject: function(point) {
    point = new L.Point(point.x, point.y).divideBy(this._earthRadius);
    return this.projection.unproject(point);
  }
});