# jotree

> 封装potree开发中常用的一些API

Latest version **1.0.8** (published 2023-11-20) · ISC license · 0 weekly downloads

## Install

```sh
npm install jotree
pnpm add jotree
yarn add jotree
bun add jotree
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; large bundle.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.8 |
| Published | 2023-11-20 |
| First published | 2023-11-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 9 |
| Unpacked size | 42 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | WenJieZheng |
| Maintainers | even_jie |
| Keywords | three |

## Links

- npm: https://www.npmjs.com/package/jotree
- Repository: https://github.com/EvenJie-XR/jhree
- Homepage: https://github.com/EvenJie-XR/jhree#readme
- Issues: https://github.com/EvenJie-XR/jhree/issues
- npm.io page: https://npm.io/package/jotree

## Dependencies (9)

- [vue](https://npm.io/package/vue.md) ^3.2.45
- [sass](https://npm.io/package/sass.md) ^1.57.1
- [three](https://npm.io/package/three.md) ^0.149.0
- [jotree](https://npm.io/package/jotree.md) ^1.0.5
- [@turf/turf](https://npm.io/package/@turf/turf.md) ^6.5.0
- [vue-router](https://npm.io/package/vue-router.md) ^4.2.5
- [element-plus](https://npm.io/package/element-plus.md) ^2.2.28
- [@even_jie/jhree](https://npm.io/package/@even_jie/jhree.md) ^1.0.3
- [potree-and-type](https://npm.io/package/potree-and-type.md) ^1.8.5

## Recent versions

- 1.0.8 (latest) — 2023-11-20
- 1.0.7 — 2023-11-20
- 1.0.6 — 2023-11-20
- 1.0.5 — 2023-11-20
- 1.0.4 — 2023-11-20
- 1.0.3 — 2023-11-20
- 1.0.2 — 2023-11-19
- 1.0.1 — 2023-11-19
- 1.0.0 — 2023-11-19

## README

# Jotree

# 如何在npm里面使用

1. 安装依赖

	```js
	npm i jotree potree-and-type
	```

2. 在node_modules里面找到```jotree```，把```potreePublic```里面的libs和resources、workers文件夹复制到项目的public目录（vue项目中）

![public](https://files.catbox.moe/mrocwe.png)

1. 在main.ts中加入如下代码（vue项目中）
	```js
	import * as Potree from "potree-and-type"

	window.Potree = Potree;
	window.Potree.scriptPath = `${window.Potree.scriptPath}${import.meta.env.BASE_URL}`;
	window.Potree.resourcePath = `${window.Potree.scriptPath}/resources`;
	```
2. 在index.html中加入如下代码：
	```html
	<!doctype html>
	<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<link rel="icon" type="image/svg+xml" href="/vite.svg" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<!-- 添加需要的依赖项 -->
		<script src="./public/libs/jquery/jquery-3.1.1.min.js"></script>
		<script src="./public/libs/spectrum/spectrum.js"></script>
		<script src="./public/libs/jquery-ui/jquery-ui.min.js"></script>
		<script src="./public/libs/other/BinaryHeap.js"></script>
		<script src="./public/libs/tween/tween.min.js"></script>
		<script src="./public/libs/d3/d3.js"></script>
		<script src="./public/libs/proj4/proj4.js"></script>
		<script src="./public/libs/openlayers3/ol.js"></script>
		<script src="./public/libs/i18next/i18next.js"></script>
		<script src="./public/libs/jstree/jstree.js"></script>
		<script src="./public/libs/plasio/js/laslaz.js"></script>
		<!--  -->
		<title>Vite + Vue + TS</title>
	</head>
	<body>
		<div id="app"></div>
		<script type="module" src="/src/main.ts"></script>
	</body>
	</html>

	```
3. 写一个hello world场景（vue项目中）
	```js
	// App.vue
	<template>
		<div class="three-container" ref="threeContainer"></div>
	</template>
	<script lang="ts" setup>
	import { Jotree } from "jotree"
	import { onMounted, ref } from "vue";

	const threeContainer = ref()
	onMounted(() => {
		const jotree = new Jotree(threeContainer.value);
		jotree.loadPointCloud("data/pointclouds/room/metadata.json", "room", () => {
			
		})
	})
	</script>

	<style lang="scss" scoped>
	.three-container {
		width: 100%;
		height: 100%;
	}
	</style>
	```
![helloworld](https://files.catbox.moe/hdoy4e.png)

---
_Source: https://npm.io/package/jotree · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
