Giter VIP home page Giter VIP logo

react-fmap's Introduction

react-fmap

fengmap for react

npm NPM downloads

Using

  • install

npm i react-fmap

  • using in react
import FMap from 'react-fmap';
class App extends Component {
 render() {
 	const mapProps = {
 		fmapID: 'wafer-beijing',
 			appName:'北京威发新世纪',
 			mapKey:'3e7dba2418ac46e1af5a1abf17082db2',
 			height: 'calc(100vh - 254px)'
 		};

 		return (
 			<div className="App">
 				<FMap {...mapProps}/>
 			</div>
 		);
 	}
}

notice: mapKey is key of FengMap.

Props

Prop default value is required description
url dome url false fengmap.min.js
fmapID true feng map id
appName false application name
mapKey true feng map key
onClick false a callback for click map
className false map mount dom's class name
width false map mount dom's width
height false map mount dom's height
defaultViewMode top false 3d or 2d, value of ['3d', 'top']
mapOptions false new FMMap's other props
textMarkers [] false text marker eg: {x, y, name[, z, ...]}
imageMarkers [] false image marker eg: {x, y, url[, z, ...]}
toolControl null false map control tool. eg: 2d or 3d tool
controlOptions null false map control options, eg: position or offset
offLineOptions object false off line map props
popMarkers null false pop marker. props is controlOptions.
initialPosition null false initial move to position.
loadComplete null false map load complete function.
drawNaviLines null false [{lineStyle, startPoint, endPoint}]
rotate 0 false set map rotate angle
mapServerURL false set map server url
mapThemeURL false set map theme url
defaultThemeName false set map theme name

offLineOptions

	offLineOptions: {
		mapServerURL: '',
		mapThemeURL: '',
		defaultThemeName: ''
		[,
		...other props
		]
	}

function

name props return description
setViewMode mode: string ['top', '3d'] this.map return fengmap object
setTheme themeName: string void set map theme name
setPopMarker options: {} popMarker pop mark on map. call popMarker.close() close pop marker
getSearchReq (request, callback) Array: FMap search map. request is object.eg: {ID: ''}
onNavigation options: {} FMap get navigation object
onMapFunction name[, options] null apply map function

add text marker

	this.map.getSearchReq({ID: 61}, v => {
		this.map.addTextMarker([{
		x: 12958819.3,
		y: 4852556.59,
		z: 0,
		name: '3F04'
		}], v.groupID);
	});

add image marker

 this.map.addImageMarker([{
		x:  12958819.3,
		y: 4852556.59,
		z: 0,
		name: '3F01',
		url: '/static/media/logo.5d5d9eef.svg'
	}], v.groupID);

onMapFunction

	this.map.onMapFunction('moveTo', {x: 12958819.3, y: 4852556.59, groupID: 1, z: 0});

fengmap.min.js

if localize fengmap.min.js, then copy `node_modules/react-fmap/js/fengmap.min.js` to src(or can reach at a dir).

then set `url`.

react-fmap's People

Contributors

xuqiang1227 avatar vkingw avatar dependabot[bot] avatar

Stargazers

孙鸿健 avatar  avatar 谦腾 avatar  avatar

Watchers

James Cloos avatar  avatar

Forkers

norepeat

react-fmap's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.