示例#1
0
 private KMLLayerBuilder(KMLLayerBuilder oCopySource)
     : base(oCopySource.Title, MainForm.WorldWindowSingleton, oCopySource.Parent)
 {
     m_oSourceFile = oCopySource.m_oSourceFile;
     m_oRenderable = KMLCreation.CreateKMLLayer(m_oSourceFile, MainForm.WorldWindowSingleton.CurrentWorld, out m_oBounds);
     m_oRenderable.RenderPriority = RenderPriority.TerrainMappedImages;
 }
示例#2
0
 internal static RenderableObject CreateKMLLayer(KMLFile oSource, World oWorld, out GeographicBoundingBox oBounds)
 {
     oBounds = GeographicBoundingBox.NullBox();
     RenderableObject result = Construct(Path.GetDirectoryName(oSource.Filename), oSource.Document, oWorld, oBounds, null, null);
     if (!oBounds.IsValid) oBounds = new GeographicBoundingBox(90.0, -90.0, -180.0, 180.0);
     return result;
 }
示例#3
0
 internal KMLLayerBuilder(String strFilename, String strLayerName, WorldWindow oWorldWindow, IBuilder oParent, GeographicBoundingBox oBounds)
     : base(strLayerName, oWorldWindow, oParent)
 {
     m_strInitFilename = strFilename;
     if (File.Exists(m_strInitFilename))
     {
         m_oSourceFile = new KMLFile(strFilename);
         m_oRenderable = KMLCreation.CreateKMLLayer(m_oSourceFile, oWorldWindow.CurrentWorld, out m_oBounds);
         if (oBounds != null)
             m_oBounds = oBounds;
         m_oRenderable.RenderPriority = RenderPriority.TerrainMappedImages;
     }
 }
示例#4
0
        internal KMLFeature(XmlElement element, KMLFile source)
            : base(element, source)
        {
            m_oInlineStyles = KMLStyleSelector.GetStyleSelectors(element, source);

            foreach (XmlNode oChild in element.ChildNodes)
            {
                if (!(oChild.NodeType == XmlNodeType.Element)) continue;
                XmlElement oChildElement = oChild as XmlElement;

                if (oChildElement.Name.Equals("name"))
                {
                    m_strName = oChildElement.InnerText;
                }
                else if (oChildElement.Name.Equals("visibility"))
                {
                    m_blVisibility = oChildElement.InnerText.Equals("1");
                }
                else if (oChildElement.Name.Equals("open"))
                {
                    m_blOpen = oChildElement.InnerText.Equals("1");
                }
                else if (oChildElement.Name.Equals("styleUrl"))
                {
                    m_strStyleURL = oChildElement.InnerText;
                }
                else if (oChildElement.Name.Equals("Snippet"))
                {
                    m_strSnippet = oChildElement.InnerText;
                }
                else if (oChildElement.Name.Equals("description"))
                {
                    m_strDescription = oChildElement.InnerText;
                }
                else if (oChildElement.Name.Equals("Region"))
                {
                    m_oRegion = new KMLRegion(oChildElement, source);
                }
                else if (oChildElement.Name.Equals("TimeStamp"))
                {
                    m_oTime = new KMLTimeStamp(oChildElement, source);
                }
                else if (oChildElement.Name.Equals("TimeSpan"))
                {
                    m_oTime = new KMLTimeSpan(oChildElement, source);
                }
                else if (oChildElement.Name.Equals("Camera"))
                {
                    m_oView = new KMLCamera(oChildElement, source);
                }
                else if (oChildElement.Name.Equals("LookAt"))
                {
                    m_oView = new KMLLookAt(oChildElement, source);
                }
            }
        }
示例#5
0
 internal KMLContainer(XmlElement element, KMLFile source)
     : base(element, source)
 {
 }
示例#6
0
        internal KMLTimeStamp(XmlElement element, KMLFile source)
            : base(element, source)
        {
            bool blWhenSet = false;

            foreach (XmlNode oChild in element.ChildNodes)
            {
                if (oChild.NodeType != XmlNodeType.Element) continue;
                XmlElement oChildElement = oChild as XmlElement;

                if (oChildElement.Name.Equals("when"))
                {
                    m_oWhen = new KMLDateTime(oChildElement.InnerText);
                    blWhenSet = true;
                }
            }

            if (!blWhenSet) throw new ArgumentException("The KML file contains a 'TimeStamp' element without a 'when' element.");
        }
示例#7
0
        internal static List<KMLStyleSelector> GetStyleSelectors(XmlElement oElement, KMLFile oSource)
        {
            List<KMLStyleSelector> result = new List<KMLStyleSelector>();

            foreach (XmlNode oChild in oElement.ChildNodes)
            {
                if (oChild.NodeType != XmlNodeType.Element) continue;
                XmlElement oPointer = oChild as XmlElement;

                if (oPointer.Name.Equals("Style"))
                {
                    result.Add(new KMLStyle(oPointer, oSource));
                }
                else if (oPointer.Name.Equals("StyleMap"))
                {
                    result.Add(new KMLStyleMap(oPointer, oSource));
                }
            }

            return result;
        }
示例#8
0
        internal KMLStyleMap(XmlElement element, KMLFile source)
            : base(element, source)
        {
            foreach (XmlNode oChild in element.ChildNodes)
            {
                if (oChild.NodeType != XmlNodeType.Element) continue;
                XmlElement oChildElement = oChild as XmlElement;

                if (oChildElement.Name.Equals("Pair"))
                {
                    if (oChildElement.ChildNodes[0].InnerText.Equals("normal"))
                    {
                        m_strNormalStyle = oChildElement.ChildNodes[1].InnerText;
                    }
                    else
                    {
                        m_strHighlightStyle = oChildElement.ChildNodes[1].InnerText;
                    }
                }

            }
        }
示例#9
0
        internal KMLStyle(XmlElement element, KMLFile source)
            : base(element, source)
        {
            foreach (XmlNode oChildNode in element.ChildNodes)
            {
                if (oChildNode.NodeType != XmlNodeType.Element) continue;
                XmlElement oChildElement = oChildNode as XmlElement;

                if (oChildElement.Name.Equals("IconStyle"))
                {
                    m_oIconStyle = new KMLIconStyle(oChildElement, source);
                }
                else if (oChildElement.Name.Equals("LabelStyle"))
                {
                    m_oLabelStyle = new KMLLabelStyle(oChildElement, source);
                }
                else if (oChildElement.Name.Equals("LineStyle"))
                {
                    m_oLineStyle = new KMLLineStyle(oChildElement, source);
                }
                else if (oChildElement.Name.Equals("PolyStyle"))
                {
                    m_oPolyStyle = new KMLPolyStyle(oChildElement, source);
                }
                else if (oChildElement.Name.Equals("BalloonStyle"))
                {
                    m_oBalloonStyle = new KMLBalloonStyle(oChildElement, source);
                }
                else if (oChildElement.Name.Equals("ListStyle"))
                {
                    m_oListStyle = new KMLListStyle(oChildElement, source);
                }
            }

            if (m_oIconStyle == null) m_oIconStyle = new KMLIconStyle();
            if (m_oLabelStyle == null) m_oLabelStyle = new KMLLabelStyle();
            if (m_oLineStyle == null) m_oLineStyle = new KMLLineStyle();
            if (m_oPolyStyle == null) m_oPolyStyle = new KMLPolyStyle();
            if (m_oBalloonStyle == null) m_oBalloonStyle = new KMLBalloonStyle();
            if (m_oListStyle == null) m_oListStyle = new KMLListStyle();
        }
示例#10
0
        internal KMLOrientation(XmlElement element, KMLFile source)
            : base(element, source)
        {
            foreach (XmlNode oChild in element.ChildNodes)
            {
                if (oChild.NodeType != XmlNodeType.Element) continue;
                XmlElement oChildElement = oChild as XmlElement;

                if (oChildElement.Name.Equals("heading"))
                {
                    m_dHeading = Double.Parse(oChildElement.InnerText, CultureInfo.InvariantCulture);
                }
                else if (oChildElement.Name.Equals("tilt"))
                {
                    m_dTilt = Double.Parse(oChildElement.InnerText, CultureInfo.InvariantCulture);
                }
                else if (oChildElement.Name.Equals("roll"))
                {
                    m_dRoll = Double.Parse(oChildElement.InnerText, CultureInfo.InvariantCulture);
                }
            }
        }
示例#11
0
        internal KMLObject(XmlElement element, KMLFile source)
        {
            m_oSourceFile = source;

            if (element.HasAttribute("id"))
            {
                m_strID = element.GetAttribute("id");

                if (!source.NamedElements.ContainsKey(m_strID))
                {
                    source.NamedElements.Add(m_strID, this);
                }
            }
            if (element.HasAttribute("targetId"))
            {
                m_strTargetID = element.GetAttribute("targetId");
            }
        }
示例#12
0
        internal KMLBalloonStyle(XmlElement element, KMLFile source)
            : base(element, source)
        {
            foreach (XmlNode oChild in element.ChildNodes)
            {
                if (oChild.NodeType != XmlNodeType.Element) continue;
                XmlElement oChildElement = oChild as XmlElement;

                if (oChildElement.Name.Equals("bgColor"))
                {
                    m_oBGColor = KMLColorStyle.ParseColor(oChildElement.InnerText);
                }
                else if (oChildElement.Name.Equals("textColor"))
                {
                    m_oTextColor = KMLColorStyle.ParseColor(oChildElement.InnerText);
                }
                else if (oChildElement.Name.Equals("text"))
                {
                    m_strText = oChildElement.InnerText;
                }
                else if (oChildElement.Name.Equals("displayMode"))
                {
                    m_eDisplayMode = (KMLDisplayMode)Enum.Parse(typeof(KMLDisplayMode), oChildElement.InnerText.ToUpper());
                }
            }
        }
示例#13
0
        internal KMLNetworkLink(XmlElement element, KMLFile source)
            : base(element, source)
        {
            foreach (XmlNode oChild in element.ChildNodes)
            {
                if (oChild.NodeType != XmlNodeType.Element) continue;
                XmlElement oChildElement = oChild as XmlElement;

                if (oChildElement.Name.Equals("refreshVisibility"))
                {
                    m_blRefreshVisibility = oChildElement.InnerText.Equals("1");
                }
                else if (oChildElement.Name.Equals("flyToView"))
                {
                    m_blFlyToView = oChildElement.InnerText.Equals("1");
                }
                else if (oChildElement.Name.Equals("Link"))
                {
                    m_oLink = new KMLIconOrLink(oChildElement, source);
                }
            }

            if (m_oLink == null) throw new ArgumentException("The KML file contains a 'NetworkLink' element without a 'Link' element.");
        }
示例#14
0
 internal KMLMultiGeometry(XmlElement element, KMLPlacemark owner, KMLFile source)
     : base(element, owner, source)
 {
     m_oChildren = KMLGeometry.GetGeometries(element, owner, source);
 }
示例#15
0
        internal KMLModel(XmlElement element, KMLPlacemark owner, KMLFile source)
            : base(element, owner, source)
        {
            foreach (XmlNode oChild in element.ChildNodes)
            {
                if (oChild.NodeType != XmlNodeType.Element) continue;
                XmlElement oChildElement = oChild as XmlElement;

                if (oChildElement.Name.Equals("altitudeMode"))
                {
                    m_eAltitudeMode = (KMLAltitudeMode)Enum.Parse(typeof(KMLAltitudeMode), oChildElement.InnerText);
                }
                else if (oChildElement.Name.Equals("altitudeMode"))
                {
                    m_oLocation = new KMLLocation(oChildElement, source);
                }
                else if (oChildElement.Name.Equals("Orientation"))
                {
                    m_oOrientation = new KMLOrientation(oChildElement, source);
                }
                else if (oChildElement.Name.Equals("Scale"))
                {
                    m_oScale = new KMLScale(oChildElement, source);
                }
                else if (oChildElement.Name.Equals("Link"))
                {
                    m_oLink = new KMLIconOrLink(oChildElement, source);
                }
                else if (oChildElement.Name.Equals("ResourceMap"))
                {
                    foreach (XmlNode oResourceChild in oChildElement.ChildNodes)
                    {
                        if (oResourceChild.NodeType != XmlNodeType.Element) continue;
                        XmlElement oResourceChildElement = oResourceChild as XmlElement;

                        if (oResourceChildElement.Name.Equals("Alias"))
                        {
                            String strTargetHref = String.Empty;
                            String strSourceHref = String.Empty;

                            foreach (XmlNode oAliasChild in oResourceChildElement.ChildNodes)
                            {
                                if (oAliasChild.NodeType != XmlNodeType.Element) continue;
                                XmlElement oAliasChildElement = oAliasChild as XmlElement;

                                if (oAliasChildElement.Name.Equals("targetHref"))
                                    strTargetHref = oAliasChildElement.InnerText;
                                if (oAliasChildElement.Name.Equals("sourceHref"))
                                    strTargetHref = oAliasChildElement.InnerText;
                            }

                            if (!String.IsNullOrEmpty(strTargetHref) && !String.IsNullOrEmpty(strSourceHref))
                            {
                                m_oResourceMap.Add(strSourceHref, strTargetHref);
                            }
                        }
                    }
                }
            }

            if (m_oLocation == null) throw new ArgumentException("The KML file contains a 'Model' element without a 'Location' element.");
            if (m_oLink == null) throw new ArgumentException("The KML file contains a 'Model' element without a 'Link' element.");

            if (m_oOrientation == null) m_oOrientation = new KMLOrientation();
            if (m_oScale == null) m_oScale = new KMLScale();
        }
示例#16
0
        internal KMLScale(XmlElement element, KMLFile source)
            : base(element, source)
        {
            foreach (XmlNode oChild in element.ChildNodes)
            {
                if (oChild.NodeType != XmlNodeType.Element) continue;
                XmlElement oChildElement = oChild as XmlElement;

                if (oChildElement.Name.Equals("x"))
                {
                    m_dX = Double.Parse(oChildElement.InnerText, CultureInfo.InvariantCulture);
                }
                else if (oChildElement.Name.Equals("y"))
                {
                    m_dY = Double.Parse(oChildElement.InnerText, CultureInfo.InvariantCulture);
                }
                else if (oChildElement.Name.Equals("z"))
                {
                    m_dZ = Double.Parse(oChildElement.InnerText, CultureInfo.InvariantCulture);
                }
            }
        }
示例#17
0
        internal KMLScreenOverlay(XmlElement element, KMLFile source)
            : base(element, source)
        {
            foreach (XmlNode oChild in element.ChildNodes)
            {
                if (oChild.NodeType != XmlNodeType.Element) continue;
                XmlElement oChildElement = oChild as XmlElement;

                if (oChildElement.Name.Equals("overlayXY"))
                {
                    m_oOverlayXY = new KMLVec2(oChildElement);
                }
                else if (oChildElement.Name.Equals("screenXY"))
                {
                    m_oScreenXY = new KMLVec2(oChildElement);
                }
                else if (oChildElement.Name.Equals("rotationXY"))
                {
                    m_oRotationXY = new KMLVec2(oChildElement);
                }
                else if (oChildElement.Name.Equals("size"))
                {
                    m_oSize = new KMLVec2(oChildElement);
                }
                else if (oChildElement.Name.Equals("rotation"))
                {
                    m_dRotation = Single.Parse(oChildElement.InnerText, CultureInfo.InvariantCulture);
                }
            }
        }
示例#18
0
        internal KMLOverlay(XmlElement element, KMLFile source)
            : base(element, source)
        {
            foreach (XmlNode oChild in element.ChildNodes)
            {
                if (oChild.NodeType != XmlNodeType.Element) continue;
                XmlElement oChildElement = oChild as XmlElement;

                if (oChildElement.Name.Equals("color"))
                {
                    m_oColor = KMLColorStyle.ParseColor(oChildElement.InnerText);
                }
                else if (oChildElement.Name.Equals("drawOrder"))
                {
                    m_iDrawOrder = Int32.Parse(oChildElement.InnerText, CultureInfo.InvariantCulture);
                }
                else if (oChildElement.Name.Equals("Icon"))
                {
                    m_oIcon = new KMLIconOrLink(oChildElement, source);
                }
            }
        }
示例#19
0
        internal KMLCamera(XmlElement element, KMLFile source)
            : base(element, source)
        {
            foreach (XmlNode oChild in element.ChildNodes)
            {
                if (oChild.NodeType != XmlNodeType.Element) continue;
                XmlElement oChildElement = oChild as XmlElement;

                if (oChildElement.Name.Equals("longitude"))
                {
                    m_dLongitude = Double.Parse(oChildElement.InnerText, CultureInfo.InvariantCulture);
                }
                else if (oChildElement.Name.Equals("latitude"))
                {
                    m_dLatitude = Double.Parse(oChildElement.InnerText, CultureInfo.InvariantCulture);
                }
                else if (oChildElement.Name.Equals("altitude"))
                {
                    m_dAltitude = Double.Parse(oChildElement.InnerText, CultureInfo.InvariantCulture);
                }
                else if (oChildElement.Name.Equals("heading"))
                {
                    m_dHeading = Double.Parse(oChildElement.InnerText, CultureInfo.InvariantCulture);
                }
                else if (oChildElement.Name.Equals("tilt"))
                {
                    m_dTilt = Double.Parse(oChildElement.InnerText, CultureInfo.InvariantCulture);
                }
                else if (oChildElement.Name.Equals("roll"))
                {
                    m_dRoll = Double.Parse(oChildElement.InnerText, CultureInfo.InvariantCulture);
                }
                else if (oChildElement.Name.Equals("altitudeMode"))
                {
                    m_eAltitudeMode = (KMLAltitudeMode)Enum.Parse(typeof(KMLAltitudeMode), oChildElement.InnerText);
                }
            }
        }
示例#20
0
        internal KMLPhotoOverlay(XmlElement element, KMLFile source)
            : base(element, source)
        {
            foreach (XmlNode oChild in element.ChildNodes)
            {
                if (oChild.NodeType != XmlNodeType.Element) continue;
                XmlElement oChildElement = oChild as XmlElement;

                if (oChildElement.Name.Equals("shape"))
                {
                    m_eShape = (KMLShape)Enum.Parse(typeof(KMLShape), oChildElement.InnerText);
                }
                else if (oChildElement.Name.Equals("ViewVolume"))
                {
                    foreach (XmlNode oViewVolumeChild in oChildElement.ChildNodes)
                    {
                        if (oViewVolumeChild.NodeType != XmlNodeType.Element) continue;
                        XmlElement oViewVolumeChildElement = oViewVolumeChild as XmlElement;

                        if (oViewVolumeChildElement.Name.Equals("leftFov"))
                        {
                            m_dViewVolumeLeftFov = Double.Parse(oViewVolumeChildElement.InnerText, CultureInfo.InvariantCulture);
                        }
                        else if (oViewVolumeChildElement.Name.Equals("rightFov"))
                        {
                            m_dViewVolumeRightFov = Double.Parse(oViewVolumeChildElement.InnerText, CultureInfo.InvariantCulture);
                        }
                        else if (oViewVolumeChildElement.Name.Equals("bottomFov"))
                        {
                            m_dViewVolumeBottomFov = Double.Parse(oViewVolumeChildElement.InnerText, CultureInfo.InvariantCulture);
                        }
                        else if (oViewVolumeChildElement.Name.Equals("topFov"))
                        {
                            m_dViewVolumeTopFov = Double.Parse(oViewVolumeChildElement.InnerText, CultureInfo.InvariantCulture);
                        }
                        else if (oViewVolumeChildElement.Name.Equals("near"))
                        {
                            m_dViewVolumeNear = Double.Parse(oViewVolumeChildElement.InnerText, CultureInfo.InvariantCulture);
                        }
                    }
                }
                else if (oChildElement.Name.Equals("roll"))
                {
                    m_dRoll = Double.Parse(oChildElement.InnerText, CultureInfo.InvariantCulture);
                }
                else if (oChildElement.Name.Equals("ImagePyramid"))
                {
                    foreach (XmlNode oImagePyramidChild in oChildElement.ChildNodes)
                    {
                        if (oImagePyramidChild.NodeType != XmlNodeType.Element) continue;
                        XmlElement oImagePyramidChildElement = oImagePyramidChild as XmlElement;

                        if (oImagePyramidChildElement.Name.Equals("tileSize"))
                        {
                            m_iImagePyramidTileSize = Int32.Parse(oImagePyramidChildElement.InnerText, CultureInfo.InvariantCulture);
                        }
                        else if (oImagePyramidChildElement.Name.Equals("maxWidth"))
                        {
                            m_iImagePyramidMaxWidth = Int32.Parse(oImagePyramidChildElement.InnerText, CultureInfo.InvariantCulture);
                        }
                        else if (oImagePyramidChildElement.Name.Equals("maxHeight"))
                        {
                            m_iImagePyramidMaxHeight = Int32.Parse(oImagePyramidChildElement.InnerText, CultureInfo.InvariantCulture);
                        }
                        else if (oImagePyramidChildElement.Name.Equals("gridOrigin"))
                        {
                            m_eGridOrigin = (KMLGridOrigin)Enum.Parse(typeof(KMLGridOrigin), oImagePyramidChildElement.InnerText);
                        }
                    }
                }
                else if (oChildElement.Name.Equals("Point"))
                {
                    m_oPoint = new KMLPoint(oChildElement, this, source);
                }
            }
        }
示例#21
0
 internal KMLStyleSelector(XmlElement element, KMLFile source)
     : base(element, source)
 {
 }
示例#22
0
 internal KMLPlacemark(XmlElement element, KMLFile source)
     : base(element, source)
 {
     List<KMLGeometry> oGeometries = KMLGeometry.GetGeometries(element, this, source);
     if (oGeometries.Count == 0) throw new ArgumentException("The KML file contains a 'Placemark' element without a geometry element.");
     m_oGeometry = oGeometries[0];
 }
示例#23
0
        internal KMLTimeSpan(XmlElement element, KMLFile source)
            : base(element, source)
        {
            foreach (XmlNode oChild in element.ChildNodes)
            {
                if (oChild.NodeType != XmlNodeType.Element) continue;
                XmlElement oChildElement = oChild as XmlElement;

                if (oChild.Name.Equals("begin"))
                {
                    m_oBegin = new KMLDateTime(oChildElement.InnerText);
                }
                else if (oChild.Name.Equals("end"))
                {
                    m_oEnd = new KMLDateTime(oChildElement.InnerText);
                }
            }
        }
示例#24
0
        internal KMLPoint(XmlElement element, KMLFeature owner, KMLFile source)
            : base(element, owner, source)
        {
            bool blCoordinatesSet = false;

            foreach (XmlNode oChild in element.ChildNodes)
            {
                if (oChild.NodeType != XmlNodeType.Element) continue;
                XmlElement oChildElement = oChild as XmlElement;

                if (oChildElement.Name.Equals("extrude"))
                {
                    m_blExtrude = oChildElement.InnerText.Equals("1");
                }
                else if (oChildElement.Name.Equals("altitudeMode"))
                {
                    m_eAltitudeMode = (KMLAltitudeMode)Enum.Parse(typeof(KMLAltitudeMode), oChildElement.InnerText);
                }
                else if (oChildElement.Name.Equals("coordinates"))
                {
                    m_oCoords = new KMLCoordinates(oChildElement.InnerText.Trim());
                    blCoordinatesSet = true;
                }
            }

            if (!blCoordinatesSet) throw new ArgumentException("The KML file contains a 'Point' element without a 'Coordinates' element.");
        }
示例#25
0
        internal KMLColorStyle(XmlElement element, KMLFile source)
            : base(element, source)
        {
            foreach (XmlNode oChild in element.ChildNodes)
            {
                if (oChild.NodeType != XmlNodeType.Element) continue;
                XmlElement oChildElement = oChild as XmlElement;

                if (oChildElement.Name.Equals("color"))
                {
                    m_oColor = ParseColor(oChildElement.InnerText);
                }
                else if (oChildElement.Name.Equals("colorMode"))
                {
                    m_eColorMode = (KMLColorMode)Enum.Parse(typeof(KMLColorMode), oChildElement.InnerText);
                }
            }
        }
示例#26
0
        internal KMLPolygon(XmlElement element, KMLPlacemark owner, KMLFile source)
            : base(element, owner, source)
        {
            foreach (XmlNode oChild in element.ChildNodes)
            {
                if (oChild.NodeType != XmlNodeType.Element) continue;
                XmlElement oChildElement = oChild as XmlElement;

                if (oChildElement.Name.Equals("extrude"))
                {
                    m_blExtrude = oChildElement.InnerText.Equals("1");
                }
                else if (oChildElement.Name.Equals("extrude"))
                {
                    m_blTessellate = oChildElement.InnerText.Equals("1");
                }
                else if (oChildElement.Name.Equals("altitudeMode"))
                {
                    m_eAltitudeMode = (KMLAltitudeMode)Enum.Parse(typeof(KMLAltitudeMode), oChildElement.InnerText);
                }
                else if (oChildElement.Name.Equals("outerBoundaryIs"))
                {
                    foreach (XmlNode oOuterBoundaryNode in oChildElement)
                    {
                        if (oOuterBoundaryNode.NodeType != XmlNodeType.Element) continue;
                        XmlElement oOuterBoundaryElement = oOuterBoundaryNode as XmlElement;

                        if (oOuterBoundaryElement.Name.Equals("LinearRing"))
                        {
                            m_oOuterBoundary = new KMLLinearRing(oOuterBoundaryElement, owner, source);
                        }
                    }
                }
                else if (oChildElement.Name.Equals("innerBoundaryIs"))
                {
                    foreach (XmlNode oInnerBoundaryNode in oChildElement)
                    {
                        if (oInnerBoundaryNode.NodeType != XmlNodeType.Element) continue;
                        XmlElement oInnerBoundaryElement = oInnerBoundaryNode as XmlElement;

                        if (oInnerBoundaryElement.Name.Equals("LinearRing"))
                        {
                            m_oInnerBoundaries.Add(new KMLLinearRing(oInnerBoundaryElement, owner, source));
                        }
                    }
                }
            }

            if (m_oOuterBoundary == null) throw new ArgumentException("The KML file contains a 'Polygon' element without an 'outerBoundaryIs' element.");
        }
示例#27
0
 internal KMLDocument(XmlElement element, KMLFile source)
     : base(element, source)
 {
     m_oFeatures = KMLFeature.GetFeatures(element, source);
 }
示例#28
0
        internal KMLPolyStyle(XmlElement element, KMLFile source)
            : base(element, source)
        {
            foreach (XmlNode oChild in element.ChildNodes)
            {
                if (oChild.NodeType != XmlNodeType.Element) continue;
                XmlElement oChildElement = oChild as XmlElement;

                if (oChildElement.Name.Equals("fill"))
                {
                    m_blFill = oChildElement.InnerText.Equals("1");
                }
                else if (oChildElement.Name.Equals("outline"))
                {
                    m_blOutline = oChildElement.InnerText.Equals("1");
                }
            }
        }
示例#29
0
        internal static List<KMLFeature> GetFeatures(XmlElement oElement, KMLFile oSource)
        {
            List<KMLFeature> result = new List<KMLFeature>();

            foreach (XmlNode oChild in oElement.ChildNodes)
            {
                if (oChild.NodeType != XmlNodeType.Element) continue;
                XmlElement oChildElement = oChild as XmlElement;

                if (oChildElement.Name.Equals("NetworkLink"))
                {
                    result.Add(new KMLNetworkLink(oChildElement, oSource));
                }
                else if (oChildElement.Name.Equals("Placemark"))
                {
                    result.Add(new KMLPlacemark(oChildElement, oSource));
                }
                else if (oChildElement.Name.Equals("PhotoOverlay"))
                {
                    result.Add(new KMLPhotoOverlay(oChildElement, oSource));
                }
                else if (oChildElement.Name.Equals("ScreenOverlay"))
                {
                    result.Add(new KMLScreenOverlay(oChildElement, oSource));
                }
                else if (oChildElement.Name.Equals("GroundOverlay"))
                {
                    result.Add(new KMLGroundOverlay(oChildElement, oSource));
                }
                else if (oChildElement.Name.Equals("Folder"))
                {
                    result.Add(new KMLFolder(oChildElement, oSource));
                }
            }

            return result;
        }
示例#30
0
        internal KMLRegion(XmlElement element, KMLFile source)
            : base(element, source)
        {
            foreach (XmlNode oChild in element.ChildNodes)
            {
                if (oChild.NodeType != XmlNodeType.Element) continue;
                XmlElement oChildElement = oChild as XmlElement;

                if (oChildElement.Name.Equals("LatLonAltBox"))
                {
                    m_oBox = new KMLLatLonAltBox(oChildElement, source);
                }
                else if (oChildElement.Name.Equals("LatLonAltBox"))
                {
                    m_oLod = new KMLLod(oChildElement, source);
                }
            }

            if (m_oBox == null) throw new ArgumentException("The KML file contains a 'Region' element without a 'LatLonAltBox' element.");
        }