Пример #1
0
        public void WriteXml(StringBuilder sb, int indent, NodeLink[] allLinks)
        {
            Vector3 p = new Vector3();

            p.X = PositionX / 4.0f;
            p.Y = PositionY / 4.0f;
            p.Z = PositionZ / 32.0f;
            int linkCount    = LinkCountFlags.Value >> 3;
            int linkCountUnk = LinkCountFlags.Value & 7;

            YndXml.ValueTag(sb, indent, "AreaID", AreaID.ToString());
            YndXml.ValueTag(sb, indent, "NodeID", NodeID.ToString());
            YndXml.StringTag(sb, indent, "StreetName", YndXml.HashString(StreetName));
            YndXml.SelfClosingTag(sb, indent, "Position " + FloatUtil.GetVector3XmlString(p));
            YndXml.ValueTag(sb, indent, "Flags0", Flags0.Value.ToString());
            YndXml.ValueTag(sb, indent, "Flags1", Flags1.Value.ToString());
            YndXml.ValueTag(sb, indent, "Flags2", Flags2.Value.ToString());
            YndXml.ValueTag(sb, indent, "Flags3", Flags3.Value.ToString());
            YndXml.ValueTag(sb, indent, "Flags4", Flags4.Value.ToString());
            YndXml.ValueTag(sb, indent, "Flags5", linkCountUnk.ToString());

            NodeLink[] links = null;
            if (linkCount > 0)
            {
                links = new NodeLink[linkCount];
                for (int i = 0; i < linkCount; i++)
                {
                    links[i] = allLinks[LinkID + i];
                }
            }
            YndXml.WriteItemArray(sb, links, indent, "Links");
        }
Пример #2
0
        public void WriteXml(StringBuilder sb, int indent)
        {
            YndXml.ValueTag(sb, indent, "VehicleNodeCount", NodesCountVehicle.ToString());
            YndXml.ValueTag(sb, indent, "PedNodeCount", NodesCountPed.ToString());

            XmlNodeWrapper[] nodes = null;
            int nodecount          = Nodes?.Length ?? 0;

            if (nodecount > 0)
            {
                nodes = new XmlNodeWrapper[nodecount];
                for (int i = 0; i < nodecount; i++)
                {
                    nodes[i] = new XmlNodeWrapper(Nodes[i], Links);
                }
            }
            YndXml.WriteItemArray(sb, nodes, indent, "Nodes");


            XmlJunctionWrapper[] juncs = null;
            int junccount = Junctions?.Length ?? 0;

            if (junccount > 0)
            {
                juncs = new XmlJunctionWrapper[junccount];
                for (int i = 0; i < junccount; i++)
                {
                    juncs[i] = new XmlJunctionWrapper(Junctions[i], JunctionHeightmapBytes);
                }
            }
            YndXml.WriteItemArray(sb, juncs, indent, "Junctions");

            YndXml.WriteItemArray(sb, JunctionRefs, indent, "JunctionRefs");
        }