Ejemplo n.º 1
0
 public void RemoveVegetationSemantic(VegetationSemantic vegetationBoundary)
 {
     vegetationBoundaries.Remove(vegetationBoundary);
     RefreshVegetation();
 }
        protected void ParseElement(XmlTextReader r)
        {
            bool readEnd = true;

            // set the field in this object based on the element we just read
            switch (r.Name)
            {
            case "name":
                // read the value
                r.Read();
                if (r.NodeType != XmlNodeType.Text)
                {
                    return;
                }
                name = string.Format("{0} - unique boundary - {1}", r.Value, uniqueNum);
                uniqueNum++;

                break;

            case "points":
                ParsePoints(r);
                readEnd = false;
                break;

            case "boundarySemantic":
                BoundarySemanticType type = BoundarySemanticType.None;

                for (int i = 0; i < r.AttributeCount; i++)
                {
                    r.MoveToAttribute(i);

                    // set the field in this object based on the element we just read
                    switch (r.Name)
                    {
                    case "type":
                        switch (r.Value)
                        {
                        case "SpeedTreeForest":
                            type = BoundarySemanticType.SpeedTreeForest;
                            break;

                        case "WaterPlane":
                            type = BoundarySemanticType.WaterPlane;
                            break;

                        case "Vegetation":
                            type = BoundarySemanticType.Vegetation;
                            break;
                        }
                        break;
                    }
                }
                r.MoveToElement();     //Moves the reader back to the element node.

                switch (type)
                {
                case BoundarySemanticType.SpeedTreeForest:
                    Forest forest = new Forest(sceneNode, r);
                    this.AddSemantic(forest);
                    break;

                case BoundarySemanticType.WaterPlane:
                    WaterPlane water = new WaterPlane(sceneNode, r);
                    this.AddSemantic(water);
                    break;

                case BoundarySemanticType.Vegetation:
                    VegetationSemantic vegetationBoundary = new VegetationSemantic(r);
                    this.AddSemantic(vegetationBoundary);
                    break;

                default:
                    break;
                }
                readEnd = false;
                break;
            }

            if (readEnd)
            {
                // error out if we dont see an end element here
                r.Read();
                if (r.NodeType != XmlNodeType.EndElement)
                {
                    return;
                }
            }
        }
Ejemplo n.º 3
0
 public void AddVegetationSemantic(VegetationSemantic vegetationBoundary)
 {
     vegetationBoundaries.Add(vegetationBoundary);
     RefreshVegetation();
 }