Beispiel #1
0
 public void Attach(Legend.TreeItem child)
 {
     if (this.children == null)
     {
         this.children = new System.Collections.ArrayList();
     }
     this.children.Add(child);
 }
Beispiel #2
0
 private void BuildClientSideTree(System.Collections.ArrayList tree, Legend.TreeItem parent, string parentName, bool fulldata, string container, MgResourceService resSrvc, System.Collections.Hashtable layerMap)
 {
     int treeIndex = 0;
     for (int pass = 0; pass < 2; pass++)
     {
         for (int i = 0; i < tree.Count; i++)
         {
             Legend.TreeItem node = (Legend.TreeItem)tree[i];
             if (node.isGroup)
             {
                 if (pass == 1)
                 {
                     string groupName = "grp" + this.intermediateVar++;
                     string arrChildName;
                     if (node.children != null)
                     {
                         arrChildName = "c" + this.intermediateVar++;
                         this.output = this.output + "var " + arrChildName + " = new Array();\n";
                     }
                     else
                     {
                         arrChildName = "null";
                     }
                     MgLayerGroup rtLayerGroup = (MgLayerGroup)node.rtObject;
                     if (fulldata)
                     {
                         this.output += string.Format("var {0} = new GroupItem(\"{1}\", {2}, {3}, {4},{5}, \"{6}\", \"{7}\", {8});\n", new object[]
                     {
                         groupName,
                         this.StrEscape(rtLayerGroup.GetLegendLabel()),
                         rtLayerGroup.GetExpandInLegend() ? "true" : "false",
                         parentName,
                         rtLayerGroup.GetVisible() ? "true" : "false",
                         rtLayerGroup.GetDisplayInLegend() ? "true" : "false",
                         rtLayerGroup.GetObjectId(),
                         this.StrEscape(rtLayerGroup.GetName()),
                         (rtLayerGroup.GetLayerGroupType() == 2) ? "true" : "false"
                     });
                     }
                     else
                     {
                         this.output += string.Format("var {0} = new GroupSummary(\"{1}\", \"{2}\", {3}, {4});\n", new object[]
                     {
                         groupName,
                         this.StrEscape(rtLayerGroup.GetName()),
                         rtLayerGroup.GetObjectId(),
                         arrChildName,
                         parentName
                     });
                     }
                     this.output += string.Format("{0}[{1}] = {2};\n", container, treeIndex, groupName);
                     treeIndex++;
                     if (node.children != null)
                     {
                         this.BuildClientSideTree(node.children, node, groupName, fulldata, arrChildName, resSrvc, null);
                         this.output += string.Format("{0}.children = {1};\n", groupName, arrChildName);
                     }
                 }
             }
             else if (pass == 0)
             {
                 MgLayer rtLayer = (MgLayer)node.rtObject;
                 if (fulldata)
                 {
                     MgResourceIdentifier resId = rtLayer.GetLayerDefinition();
                     string layerData = node.layerData;
                     string layerName = "lyr" + this.intermediateVar++;
                     string objectId = rtLayer.GetObjectId();
                     this.output += string.Format("var {0} = new LayerItem(\"{1}\", \"{2}\", {3}, {4}, {5}, {6}, {7}, \"{8}\", \"{9}\", {10});\n", new object[]
                 {
                     layerName,
                     rtLayer.GetLegendLabel(),
                     this.StrEscape(rtLayer.GetName()),
                     rtLayer.GetExpandInLegend() ? "true" : "false",
                     parentName,
                     rtLayer.GetVisible() ? "true" : "false",
                     rtLayer.GetDisplayInLegend() ? "true" : "false",
                     rtLayer.GetSelectable() ? "true" : "false",
                     resId.ToString(),
                     objectId,
                     (rtLayer.GetLayerType() == 2) ? "true" : "false"
                 });
                     this.output += string.Format("{0}[{1}] = {2};\n", container, treeIndex, layerName);
                     treeIndex++;
                     if (layerMap == null || !layerMap.ContainsKey(objectId))
                     {
                         this.BuildLayerDefinitionData(layerData, layerName);
                     }
                 }
                 else
                 {
                     this.output += string.Format("{0}[{1}] = new LayerSummary(\"{2}\", \"{3}\", \"{4}\");\n", new object[]
                 {
                     container,
                     i,
                     rtLayer.GetName(),
                     rtLayer.GetObjectId(),
                     rtLayer.GetLayerDefinition().ToString()
                 });
                 }
             }
         }
     }
 }