npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fhmap

v0.0.5

Published

fhmap

Downloads

2

Readme

fhmap

fhmap主要是用来使项目中地图功能的兼容性和扩展性更强,代码更容易维护,同时使切换地图的开发工作任务更少,成本更低

安装

npm install fhmap --save  

使用

//整个引入
import fhmap from 'fhmap'

//部分引入  
import {Map, Point} from 'fhmap'  

fhmap类概览

  • 核心类:

Map

  • 基础类:

PointPixelBoundsSize

  • 控件类:

ControlNavigationControlGeolocationControlOverviewMapControlScaleControlCopyrightControlMapTypeControlPanoramaControl

  • 覆盖物类:

OverlayMarkerIconInfoWindowLabelPolylineIconSequencePolygonCircleGroundOverlayPointCollectionHotspotSymbolCanvasLayer

  • 右键菜单类:

ContextMenuMenuItem

  • 地图类型类:

MapType

  • 地图图层类:

TileLayerTrafficLayerCustomLayerPanoramaCoverageLayer

  • 服务类:

LocalSearchTransitRouteWalkingRouteRidingRouteDrivingRouteGeocoderLocalCityGeolocationBusLineSearchAutocompleteBoundaryConvertor

  • 全景类:

PanoramaPanoramaServicePanoramaLabel

  • 地图工具类:

tools

  • 地图接口类:

apis

  • 工具类:

utils

###关于地图差异性解决的建议

由于每个地图厂商提供的地图类和方法名称可能不一致,建议在项目中新建一个allmap.js

 //allmap.js
 import {
  Map,
  //
  Point,
  Pixel,
  Bounds,
  Size,
  //
  Control,
  NavigationControl,
  GeolocationControl,
  OverviewMapControl,
  ScaleControl,
  CopyrightControl,
  MapTypeControl,
  PanoramaControl,
  //
  Overlay,
  Marker,
  Icon,
  InfoWindow,
  Label,
  Polyline,
  IconSequence,
  Polygon,
  Circle,
  GroundOverlay,
  PointCollection,
  Hotspot,
  Symbol,
  CanvasLayer,
  //
  ContextMenu,
  MenuItem,
  //
  MapType,
  //
  TileLayer,
  TrafficLayer,
  CustomLayer,
  PanoramaCoverageLayer,
  //
  LocalSearch,
  TransitRoute,
  WalkingRoute,
  RidingRoute,
  DrivingRoute,
  Geocoder,
  LocalCity,
  Geolocation,
  BusLineSearch,
  Autocomplete,
  Boundary,
  Convertor,
  //
  Panorama,
  PanoramaService,
  PanoramaLabel,
  //
  mapTools,
  //
  mapApis,
  //
  utils
} from 'fhmap' 

let mapProvider = getMapProvider();
//为避免和对象原有方法冲突,建议在方法名称前加下划线_区分
Pixel.prototype._equals = function(otherPixel) {
  if (mapProvider == "baidu") {
    return this.equals(otherPixel);
  } else {
    console.error("[Pixel]不支持该地图调用此方法");
  }
};

//...  

export {
  ...
}

业务代码中使用

import {Map, Point} from './allmap'
...

###地图类的支持性如下

| 类 | 百度 | 凯立德 | 图盟 | | ----| ---- | ---- | ---- | | (核心类)Map | 支持 | 支持 | | | (基础类)Point | 支持 | 支持 | | | (基础类)Pixel | 支持 | 支持 | | | (基础类)Bounds | 支持 | 支持 | | | (基础类)Size | 支持 | 支持 | | | (控件类)Control | 支持 | 支持 | | | (控件类)NavigationControl | 支持 | | | | (控件类)GeolocationControl | 支持 | | | | (控件类)OverviewMapControl | 支持 | | | | (控件类)ScaleControl | 支持 | | | | (控件类)CopyrightControl | 支持 | | | | (控件类)MapTypeControl | 支持 | | | | (控件类)PanoramaControl | 支持 | | | | (覆盖物类)Overlay | 支持 | | | | (覆盖物类)Marker | 支持 | | | | (覆盖物类)Icon | 支持 | | | | (覆盖物类)InfoWindow | 支持 | | | | (覆盖物类)Label | 支持 | | | | (覆盖物类)Polyline | 支持 | | | | (覆盖物类)IconSequence | 支持 | | | | (覆盖物类)Polygon | 支持 | | | | (覆盖物类)Circle | 支持 | | | | (覆盖物类)GroundOverlay | 支持 | | | | (覆盖物类)PointCollection | 支持 | | | | (覆盖物类)Hotspot | 支持 | | | | (覆盖物类)Symbol | 支持 | | | | (覆盖物类)CanvasLayer | 支持 | | | | (右键菜单类)ContextMenu | 支持 | | | | (右键菜单类)MenuItem | 支持 | | | | (地图类型类)MapType | 支持 | | | | (地图图层类)TileLayer | 支持 | | | | (地图图层类)TrafficLayer | 支持 | | | | (地图图层类)CustomLayer | 支持 | | | | (地图图层类)PanoramaCoverageLayer | 支持 | | | | (服务类)LocalSearch | 支持 | | | | (服务类)TransitRoute | 支持 | | | | (服务类)WalkingRoute | 支持 | | | | (服务类)RidingRoute | 支持 | | | | (服务类)DrivingRoute | 支持 | | | | (服务类)Geocoder | 支持 | | | | (服务类)LocalCity | 支持 | | | | (服务类)Geolocation | 支持 | | | | (服务类)BusLineSearch | 支持 | | | | (服务类)Autocomplete | 支持 | | | | (服务类)Boundary | 支持 | | | | (服务类)Convertor | 支持 | | | | (全景类)Panorama | 支持 | | | | (全景类)PanoramaService | 支持 | | | | (全景类)PanoramaLabel | 支持 | | |