|
@@ -20,6 +20,36 @@ export class Template {
|
|
|
|
|
|
scatteredContainers: Array<Container>;
|
|
|
|
|
|
+ static getContainerById(id: string, template: Template): Container {
|
|
|
+ return Container.getContainerById(id, template.frame);
|
|
|
+ }
|
|
|
+
|
|
|
+ static getMainPipeById(id: string, template: Template): MainPipe {
|
|
|
+ if(template.mainPipes){
|
|
|
+ for(const mp of template.mainPipes){
|
|
|
+ if(mp.id == id)
|
|
|
+ return mp;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ static getContainers(template: Template): Array<Container> {
|
|
|
+ const result = new Array<Container>();
|
|
|
+ Template.doGetContainers(template.frame, result);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ private static doGetContainers(con: Container, result: Array<Container>){
|
|
|
+ result.push(con);
|
|
|
+ if(con.children && con.children.length > 0){
|
|
|
+ con.children.forEach(comp => {
|
|
|
+ if(comp.compType == 'container')
|
|
|
+ Template.doGetContainers(<Container>comp, result);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
static findRelatedMainPipes(con: Container, template: Template): Array<MainPipe> {
|
|
|
const mps = new Array<MainPipe>();
|
|
|
while(true) {
|
|
@@ -27,7 +57,7 @@ export class Template {
|
|
|
break;
|
|
|
|
|
|
for(const mp of template.mainPipes) {
|
|
|
- if(mp.relatedContainers && mp.relatedContainers.indexOf(con.id) >= 0){
|
|
|
+ if(mp.bindEquipment && mp.relatedContainers && mp.relatedContainers.indexOf(con.id) >= 0){
|
|
|
if(mps.indexOf(mp) < 0) {
|
|
|
mps.push(mp);
|
|
|
}
|
|
@@ -39,6 +69,33 @@ export class Template {
|
|
|
return mps;
|
|
|
}
|
|
|
|
|
|
+ static findDynSrcs(el: any, template: Template, ignoreEl: any, srcs: Array<string>){
|
|
|
+ if(el.compType == 'mainPipe') {
|
|
|
+ const mp = <MainPipe>el;
|
|
|
+ const relCons = mp.relatedContainers;
|
|
|
+ if(relCons && relCons.length > 0) {
|
|
|
+ for(const conId of relCons) {
|
|
|
+ const relCon = Template.getContainerById(conId, template);
|
|
|
+ if(relCon)
|
|
|
+ Template.findDynSrcs(relCon, template, ignoreEl, srcs);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if(el.compType == 'container') {
|
|
|
+ const con = <Container>el;
|
|
|
+ if(con.dynGroup) {
|
|
|
+ var srcObj;
|
|
|
+ if(con.dynGroup.dynSourceType == 'container')
|
|
|
+ srcObj = Template.getContainerById(con.dynGroup.dynSource, template);
|
|
|
+ else if(con.dynGroup.dynSourceType == 'mainPipe')
|
|
|
+ srcObj = Template.getMainPipeById(con.dynGroup.dynSource, template);
|
|
|
+ if(srcObj && srcObj != ignoreEl && srcs.indexOf(srcObj) < 0)
|
|
|
+ srcs.push(srcObj);
|
|
|
+ }
|
|
|
+ if(con.parent)
|
|
|
+ Template.findDynSrcs(con.parent, template, ignoreEl, srcs);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
static clearParent(template: Template){
|
|
|
Template.clearConParent(template.frame);
|
|
|
}
|
|
@@ -91,6 +148,8 @@ export class Container extends Comp {
|
|
|
|
|
|
props: Object;
|
|
|
|
|
|
+ dynTarget: string;
|
|
|
+
|
|
|
static getEquipBoxes(con: Container, arr?: Array<Container>){
|
|
|
if(!arr)
|
|
|
arr = new Array<Container>();
|
|
@@ -116,6 +175,21 @@ export class Container extends Comp {
|
|
|
return arr;
|
|
|
}
|
|
|
|
|
|
+ static getContainerById(id: string, con: Container): Container {
|
|
|
+ if(con.id == id)
|
|
|
+ return con;
|
|
|
+ if(con.children && con.children.length > 0){
|
|
|
+ for(const c of con.children) {
|
|
|
+ if(c.compType == 'container') {
|
|
|
+ const rtn = Container.getContainerById(id, <Container>c);
|
|
|
+ if(rtn != null)
|
|
|
+ return rtn;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
export class DataFilter {
|
|
@@ -148,6 +222,8 @@ export class DynGroup {
|
|
|
|
|
|
dynSource: string;
|
|
|
|
|
|
+ dynSourceType: string;
|
|
|
+
|
|
|
labelPosition: string;
|
|
|
|
|
|
}
|
|
@@ -170,6 +246,8 @@ export class MainPipe {
|
|
|
|
|
|
locationPath: Array<Array<Point>>;
|
|
|
|
|
|
+ dynTarget: string;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
export class Legend {
|