Beispiel #1
0
        public static KModule ModuleNodeToKModule(XmlNode moduleNode)
        {
            KModule module = null;

            module = KShapeModule.TryCreateFromModuleNode(moduleNode);
            if (module == null)
            {
                module = KTextModule.TryCreateFromModuleNode(moduleNode);
            }

            if (module == null)
            {
                throw KmlParseException.UnknownModuleName(moduleNode.Name);
            }

            return(module);
        }
Beispiel #2
0
        public static KShapeModule TryCreateFromModuleNode(XmlNode moduleNode)
        {
            if (moduleNode.Name != "shape")
            {
                return(null);
            }

            var shape = new KShapeModule();

            shape.LoadBasicsFromNode(moduleNode);

            shape.Properties.Add("internal_type", "ShapeModule");

            shape.AddOptional(moduleNode, "shape", "shape_type");
            shape.AddOptional <double>(moduleNode, "width", "shape_width");
            shape.AddOptional <double>(moduleNode, "height", "shape_height");

            shape.AddOptional <double>(moduleNode, "angle", "shape_angle");

            return(shape);
        }