Compare commits
14 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
1c803d0965 | ||
|
0106643c1a | ||
|
2a2a4ce488 | ||
|
3214ef1cc4 | ||
|
78507c2b91 | ||
|
38045a1027 | ||
|
af71702840 | ||
|
461713baba | ||
|
0aa1bc102b | ||
|
8f04522278 | ||
|
02ac6e6deb | ||
|
2255232499 | ||
|
8b0ad14f73 | ||
11ee6c1531 |
@ -3,6 +3,12 @@
|
|||||||
图形应用基础框架,基于 pixi.js([官网](https://pixijs.com/), [API Docs](https://pixijs.download/release/docs/index.html))
|
图形应用基础框架,基于 pixi.js([官网](https://pixijs.com/), [API Docs](https://pixijs.download/release/docs/index.html))
|
||||||
viewport 使用的 github 开源的 pixi-viewport[pixi-viewport](https://github.com/davidfig/pixi-viewport)
|
viewport 使用的 github 开源的 pixi-viewport[pixi-viewport](https://github.com/davidfig/pixi-viewport)
|
||||||
|
|
||||||
|
# 发布版本说明
|
||||||
|
测试好可以发布时执行yarn run build进行构建,然后再提交push后,在gitea.joylink.club中进行版本发布
|
||||||
|
```
|
||||||
|
yarn run build
|
||||||
|
```
|
||||||
|
|
||||||
# 路线图
|
# 路线图
|
||||||
|
|
||||||
- ~~图形的位置、旋转属性使用 pixijs 的 transform 变换(完成)~~
|
- ~~图形的位置、旋转属性使用 pixijs 的 transform 变换(完成)~~
|
||||||
|
8
lib/app/JlGraphicApp.d.ts
vendored
8
lib/app/JlGraphicApp.d.ts
vendored
@ -355,6 +355,10 @@ export interface IGraphicScene extends EventEmitter<GraphicAppEvents> {
|
|||||||
* 取消websocket订阅
|
* 取消websocket订阅
|
||||||
*/
|
*/
|
||||||
unsubscribe(destination: string): void;
|
unsubscribe(destination: string): void;
|
||||||
|
/**
|
||||||
|
* 发布websocket消息
|
||||||
|
*/
|
||||||
|
publishMessage(destination: string, message: Uint8Array): void;
|
||||||
}
|
}
|
||||||
declare abstract class GraphicSceneBase extends EventEmitter<GraphicAppEvents> implements IGraphicScene {
|
declare abstract class GraphicSceneBase extends EventEmitter<GraphicAppEvents> implements IGraphicScene {
|
||||||
private graphicStore;
|
private graphicStore;
|
||||||
@ -489,6 +493,10 @@ declare abstract class GraphicSceneBase extends EventEmitter<GraphicAppEvents> i
|
|||||||
* 取消websocket订阅
|
* 取消websocket订阅
|
||||||
*/
|
*/
|
||||||
unsubscribe(destination: string): void;
|
unsubscribe(destination: string): void;
|
||||||
|
/**
|
||||||
|
* 发布websocket消息
|
||||||
|
*/
|
||||||
|
publishMessage(destination: string, message: Uint8Array): void;
|
||||||
/**
|
/**
|
||||||
* 处理图形状态
|
* 处理图形状态
|
||||||
* @param graphicStates
|
* @param graphicStates
|
||||||
|
2
lib/core/GraphicStore.d.ts
vendored
2
lib/core/GraphicStore.d.ts
vendored
@ -52,6 +52,7 @@ export interface GraphicQueryStore {
|
|||||||
* @param type
|
* @param type
|
||||||
*/
|
*/
|
||||||
queryByCodeAndTypeAmbiguous<T extends JlGraphic>(code: string, type: string): T[];
|
queryByCodeAndTypeAmbiguous<T extends JlGraphic>(code: string, type: string): T[];
|
||||||
|
checkIdExist(v: number): boolean;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 图形存储
|
* 图形存储
|
||||||
@ -87,4 +88,5 @@ export declare class GraphicStore implements GraphicQueryStore {
|
|||||||
* 清空
|
* 清空
|
||||||
*/
|
*/
|
||||||
clear(): void;
|
clear(): void;
|
||||||
|
checkIdExist(id: number): boolean;
|
||||||
}
|
}
|
||||||
|
2
lib/index.d.ts
vendored
2
lib/index.d.ts
vendored
@ -1,4 +1,4 @@
|
|||||||
/// <reference types="global" />
|
/// <reference path="../global.d.ts" />
|
||||||
export * as GraphicsExtras from '@pixi/graphics-extras';
|
export * as GraphicsExtras from '@pixi/graphics-extras';
|
||||||
export * from './app';
|
export * from './app';
|
||||||
export * from './core';
|
export * from './core';
|
||||||
|
37
lib/index.js
37
lib/index.js
@ -4446,6 +4446,9 @@ class GraphicStore {
|
|||||||
this.relationManage.clear();
|
this.relationManage.clear();
|
||||||
this.store.clear();
|
this.store.clear();
|
||||||
}
|
}
|
||||||
|
checkIdExist(id) {
|
||||||
|
return this.store.has(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//基础图形对象扩展
|
//基础图形对象扩展
|
||||||
@ -5279,6 +5282,10 @@ class MessageClient extends EventEmitter {
|
|||||||
removeSubscription(destination, handle) {
|
removeSubscription(destination, handle) {
|
||||||
this.getOrNewSubClient(destination).removeHandler(handle);
|
this.getOrNewSubClient(destination).removeHandler(handle);
|
||||||
}
|
}
|
||||||
|
publishMessage(destination, message) {
|
||||||
|
const cli = this.getOrNewSubClient(destination);
|
||||||
|
cli.publishMessage(destination, message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
class SubscriptionClient {
|
class SubscriptionClient {
|
||||||
mc;
|
mc;
|
||||||
@ -5321,6 +5328,11 @@ class SubscriptionClient {
|
|||||||
unsubscribe() {
|
unsubscribe() {
|
||||||
this.mc.unsubscribe(this.destination);
|
this.mc.unsubscribe(this.destination);
|
||||||
}
|
}
|
||||||
|
publishMessage(destination, message) {
|
||||||
|
if (this.mc.connected) {
|
||||||
|
this.mc.publishMessage(destination, message);
|
||||||
|
}
|
||||||
|
}
|
||||||
handleMessage(data) {
|
handleMessage(data) {
|
||||||
if (this.protocol === 'json') {
|
if (this.protocol === 'json') {
|
||||||
console.debug('收到消息:', data);
|
console.debug('收到消息:', data);
|
||||||
@ -5403,6 +5415,9 @@ class StompMessagingClient extends MessageClient {
|
|||||||
unsubscribe0(destination) {
|
unsubscribe0(destination) {
|
||||||
this.cli.unsubscribe(destination);
|
this.cli.unsubscribe(destination);
|
||||||
}
|
}
|
||||||
|
publishMessage(destination, message) {
|
||||||
|
console.debug('MQTT发布消息:未实现');
|
||||||
|
}
|
||||||
close() {
|
close() {
|
||||||
this.cli.deactivate();
|
this.cli.deactivate();
|
||||||
}
|
}
|
||||||
@ -5522,6 +5537,15 @@ class MqttMsgClient extends MessageClient {
|
|||||||
console.warn('MQTT 消息客户端关闭失败', error);
|
console.warn('MQTT 消息客户端关闭失败', error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
publishMessage(destination, message) {
|
||||||
|
console.debug('MQTT发布消息');
|
||||||
|
if (this.connected) {
|
||||||
|
this.cli.publish(destination, message);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
console.warn('MQTT 未连接,消息发布失败');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var ClientEngine;
|
var ClientEngine;
|
||||||
@ -5601,6 +5625,9 @@ class WsMsgCli {
|
|||||||
static registerAppMsgBroker(broker) {
|
static registerAppMsgBroker(broker) {
|
||||||
WsMsgCli.appMsgBroker.push(broker);
|
WsMsgCli.appMsgBroker.push(broker);
|
||||||
}
|
}
|
||||||
|
static publishMessage(destination, message) {
|
||||||
|
WsMsgCli.client.publishMessage(destination, message);
|
||||||
|
}
|
||||||
static removeAppMsgBroker(broker) {
|
static removeAppMsgBroker(broker) {
|
||||||
const index = WsMsgCli.appMsgBroker.findIndex((mb) => mb == broker);
|
const index = WsMsgCli.appMsgBroker.findIndex((mb) => mb == broker);
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
@ -5674,6 +5701,9 @@ class AppWsMsgBroker {
|
|||||||
WsMsgCli.registerSubscription(destination, handler);
|
WsMsgCli.registerSubscription(destination, handler);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
publishMessage(destination, message) {
|
||||||
|
WsMsgCli.publishMessage(destination, message);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 取消所有订阅,从通用Stomp客户端移除此消息代理
|
* 取消所有订阅,从通用Stomp客户端移除此消息代理
|
||||||
*/
|
*/
|
||||||
@ -7130,6 +7160,13 @@ class GraphicSceneBase extends EventEmitter {
|
|||||||
this.checkWsMsgCli();
|
this.checkWsMsgCli();
|
||||||
this.wsMsgBroker.unsbuscribe(destination);
|
this.wsMsgBroker.unsbuscribe(destination);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 发布websocket消息
|
||||||
|
*/
|
||||||
|
publishMessage(destination, message) {
|
||||||
|
this.checkWsMsgCli();
|
||||||
|
this.wsMsgBroker.publishMessage(destination, message);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 处理图形状态
|
* 处理图形状态
|
||||||
* @param graphicStates
|
* @param graphicStates
|
||||||
|
2
lib/message/BasicMessageClient.d.ts
vendored
2
lib/message/BasicMessageClient.d.ts
vendored
@ -33,6 +33,7 @@ export declare abstract class MessageClient extends EventEmitter<MessageClientEv
|
|||||||
getOrNewSubClient(destination: string): SubscriptionClient;
|
getOrNewSubClient(destination: string): SubscriptionClient;
|
||||||
addSubscription(destination: string, handler: IMessageHandler): void;
|
addSubscription(destination: string, handler: IMessageHandler): void;
|
||||||
removeSubscription(destination: string, handle: IMessageHandler): void;
|
removeSubscription(destination: string, handle: IMessageHandler): void;
|
||||||
|
publishMessage(destination: string, message: Uint8Array): void;
|
||||||
abstract get connected(): boolean;
|
abstract get connected(): boolean;
|
||||||
abstract close(): void;
|
abstract close(): void;
|
||||||
}
|
}
|
||||||
@ -47,6 +48,7 @@ export declare class SubscriptionClient {
|
|||||||
removeHandler(handler: IMessageHandler): void;
|
removeHandler(handler: IMessageHandler): void;
|
||||||
trySubscribe(): void;
|
trySubscribe(): void;
|
||||||
unsubscribe(): void;
|
unsubscribe(): void;
|
||||||
|
publishMessage(destination: string, message: Uint8Array): void;
|
||||||
handleMessage(data: any): void;
|
handleMessage(data: any): void;
|
||||||
onDisconnect(): void;
|
onDisconnect(): void;
|
||||||
}
|
}
|
||||||
|
8
lib/message/MessageBroker.d.ts
vendored
8
lib/message/MessageBroker.d.ts
vendored
@ -64,6 +64,12 @@ export interface IMessageClient extends EventEmitter<MessageClientEvents> {
|
|||||||
* @param handler
|
* @param handler
|
||||||
*/
|
*/
|
||||||
removeSubscription(destination: string, handler: IMessageHandler): void;
|
removeSubscription(destination: string, handler: IMessageHandler): void;
|
||||||
|
/**
|
||||||
|
* 发布消息
|
||||||
|
* @param destination
|
||||||
|
* @param message
|
||||||
|
*/
|
||||||
|
publishMessage(destination: string, message: Uint8Array): void;
|
||||||
/**
|
/**
|
||||||
* 是否已经连接
|
* 是否已经连接
|
||||||
*/
|
*/
|
||||||
@ -84,6 +90,7 @@ export declare class WsMsgCli {
|
|||||||
static registerSubscription(destination: string, handler: IMessageHandler): void;
|
static registerSubscription(destination: string, handler: IMessageHandler): void;
|
||||||
static unregisterSubscription(destination: string, handler: IMessageHandler): void;
|
static unregisterSubscription(destination: string, handler: IMessageHandler): void;
|
||||||
static registerAppMsgBroker(broker: AppWsMsgBroker): void;
|
static registerAppMsgBroker(broker: AppWsMsgBroker): void;
|
||||||
|
static publishMessage(destination: string, message: Uint8Array): void;
|
||||||
static removeAppMsgBroker(broker: AppWsMsgBroker): void;
|
static removeAppMsgBroker(broker: AppWsMsgBroker): void;
|
||||||
static hasAppMsgBroker(): boolean;
|
static hasAppMsgBroker(): boolean;
|
||||||
/**
|
/**
|
||||||
@ -138,6 +145,7 @@ export declare class AppWsMsgBroker {
|
|||||||
unsbuscribe(destination: string): void;
|
unsbuscribe(destination: string): void;
|
||||||
unsubscribeAll(): void;
|
unsubscribeAll(): void;
|
||||||
resubscribeAll(): void;
|
resubscribeAll(): void;
|
||||||
|
publishMessage(destination: string, message: Uint8Array): void;
|
||||||
/**
|
/**
|
||||||
* 取消所有订阅,从通用Stomp客户端移除此消息代理
|
* 取消所有订阅,从通用Stomp客户端移除此消息代理
|
||||||
*/
|
*/
|
||||||
|
1
lib/message/MqttBroker.d.ts
vendored
1
lib/message/MqttBroker.d.ts
vendored
@ -10,4 +10,5 @@ export declare class MqttMsgClient extends MessageClient {
|
|||||||
unsubscribe0(destination: string): void;
|
unsubscribe0(destination: string): void;
|
||||||
get connected(): boolean;
|
get connected(): boolean;
|
||||||
close(): void;
|
close(): void;
|
||||||
|
publishMessage(destination: string, message: Uint8Array): void;
|
||||||
}
|
}
|
||||||
|
1
lib/message/WsMsgBroker.d.ts
vendored
1
lib/message/WsMsgBroker.d.ts
vendored
@ -7,5 +7,6 @@ export declare class StompMessagingClient extends MessageClient {
|
|||||||
get connected(): boolean;
|
get connected(): boolean;
|
||||||
subscribe(destination: string, handle: HandleMessage): boolean;
|
subscribe(destination: string, handle: HandleMessage): boolean;
|
||||||
unsubscribe0(destination: string): void;
|
unsubscribe0(destination: string): void;
|
||||||
|
publishMessage(destination: string, message: Uint8Array): void;
|
||||||
close(): void;
|
close(): void;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "graphic-pixi",
|
"name": "graphic-pixi",
|
||||||
"version": "0.1.14",
|
"version": "0.1.18",
|
||||||
"description": "基于pixijs的图形应用、绘制应用框架",
|
"description": "基于pixijs的图形应用、绘制应用框架",
|
||||||
"productName": "Graphic-pixi",
|
"productName": "Graphic-pixi",
|
||||||
"author": "walker <shengxuqiang@joylink.club>",
|
"author": "walker <shengxuqiang@joylink.club>",
|
||||||
|
@ -612,6 +612,10 @@ export interface IGraphicScene extends EventEmitter<GraphicAppEvents> {
|
|||||||
* 取消websocket订阅
|
* 取消websocket订阅
|
||||||
*/
|
*/
|
||||||
unsubscribe(destination: string): void;
|
unsubscribe(destination: string): void;
|
||||||
|
/**
|
||||||
|
* 发布websocket消息
|
||||||
|
*/
|
||||||
|
publishMessage(destination: string, message: Uint8Array): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class GraphicSceneBase
|
abstract class GraphicSceneBase
|
||||||
@ -1158,6 +1162,13 @@ abstract class GraphicSceneBase
|
|||||||
this.checkWsMsgCli();
|
this.checkWsMsgCli();
|
||||||
this.wsMsgBroker.unsbuscribe(destination);
|
this.wsMsgBroker.unsbuscribe(destination);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 发布websocket消息
|
||||||
|
*/
|
||||||
|
publishMessage(destination: string, message: Uint8Array) {
|
||||||
|
this.checkWsMsgCli();
|
||||||
|
this.wsMsgBroker.publishMessage(destination, message);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 处理图形状态
|
* 处理图形状态
|
||||||
* @param graphicStates
|
* @param graphicStates
|
||||||
|
@ -60,6 +60,8 @@ export interface GraphicQueryStore {
|
|||||||
code: string,
|
code: string,
|
||||||
type: string
|
type: string
|
||||||
): T[];
|
): T[];
|
||||||
|
|
||||||
|
checkIdExist(v: number): boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -208,4 +210,8 @@ export class GraphicStore implements GraphicQueryStore {
|
|||||||
this.relationManage.clear();
|
this.relationManage.clear();
|
||||||
this.store.clear();
|
this.store.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkIdExist(id: number) {
|
||||||
|
return this.store.has(id)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,6 +70,11 @@ export abstract class MessageClient
|
|||||||
this.getOrNewSubClient(destination).removeHandler(handle);
|
this.getOrNewSubClient(destination).removeHandler(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
publishMessage(destination: string, message: Uint8Array): void {
|
||||||
|
const cli = this.getOrNewSubClient(destination);
|
||||||
|
cli.publishMessage(destination, message);
|
||||||
|
}
|
||||||
|
|
||||||
abstract get connected(): boolean;
|
abstract get connected(): boolean;
|
||||||
|
|
||||||
abstract close(): void;
|
abstract close(): void;
|
||||||
@ -125,6 +130,12 @@ export class SubscriptionClient {
|
|||||||
this.mc.unsubscribe(this.destination);
|
this.mc.unsubscribe(this.destination);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
publishMessage(destination: string, message: Uint8Array): void {
|
||||||
|
if (this.mc.connected) {
|
||||||
|
this.mc.publishMessage(destination, message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
handleMessage(data: any) {
|
handleMessage(data: any) {
|
||||||
if (this.protocol === 'json') {
|
if (this.protocol === 'json') {
|
||||||
console.debug('收到消息:', data);
|
console.debug('收到消息:', data);
|
||||||
|
@ -83,7 +83,12 @@ export interface IMessageClient extends EventEmitter<MessageClientEvents> {
|
|||||||
* @param handler
|
* @param handler
|
||||||
*/
|
*/
|
||||||
removeSubscription(destination: string, handler: IMessageHandler): void;
|
removeSubscription(destination: string, handler: IMessageHandler): void;
|
||||||
|
/**
|
||||||
|
* 发布消息
|
||||||
|
* @param destination
|
||||||
|
* @param message
|
||||||
|
*/
|
||||||
|
publishMessage(destination: string, message: Uint8Array): void;
|
||||||
/**
|
/**
|
||||||
* 是否已经连接
|
* 是否已经连接
|
||||||
*/
|
*/
|
||||||
@ -163,6 +168,10 @@ export class WsMsgCli {
|
|||||||
WsMsgCli.appMsgBroker.push(broker);
|
WsMsgCli.appMsgBroker.push(broker);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static publishMessage(destination: string, message: Uint8Array) {
|
||||||
|
WsMsgCli.client.publishMessage(destination, message);
|
||||||
|
}
|
||||||
|
|
||||||
static removeAppMsgBroker(broker: AppWsMsgBroker) {
|
static removeAppMsgBroker(broker: AppWsMsgBroker) {
|
||||||
const index = WsMsgCli.appMsgBroker.findIndex((mb) => mb == broker);
|
const index = WsMsgCli.appMsgBroker.findIndex((mb) => mb == broker);
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
@ -295,6 +304,10 @@ export class AppWsMsgBroker {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
publishMessage(destination: string, message: Uint8Array) {
|
||||||
|
WsMsgCli.publishMessage(destination, message);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 取消所有订阅,从通用Stomp客户端移除此消息代理
|
* 取消所有订阅,从通用Stomp客户端移除此消息代理
|
||||||
*/
|
*/
|
||||||
|
@ -112,4 +112,13 @@ export class MqttMsgClient extends MessageClient {
|
|||||||
console.warn('MQTT 消息客户端关闭失败', error);
|
console.warn('MQTT 消息客户端关闭失败', error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
publishMessage(destination: string, message: Uint8Array): void {
|
||||||
|
console.debug('MQTT发布消息');
|
||||||
|
if(this.connected) {
|
||||||
|
this.cli.publish(destination, message as Buffer);
|
||||||
|
}else {
|
||||||
|
console.warn('MQTT 未连接,消息发布失败');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -77,6 +77,10 @@ export class StompMessagingClient extends MessageClient {
|
|||||||
this.cli.unsubscribe(destination);
|
this.cli.unsubscribe(destination);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
publishMessage(destination: string, message: Uint8Array): void {
|
||||||
|
console.debug('MQTT发布消息:未实现');
|
||||||
|
}
|
||||||
|
|
||||||
close(): void {
|
close(): void {
|
||||||
this.cli.deactivate();
|
this.cli.deactivate();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user