Пример #1
0
    private static List <WMSBoundingBox> parseWMSBoundingBoxes(XmlNodeList bbXmlNodes)
    {
        List <WMSBoundingBox> boundingBoxes = new List <WMSBoundingBox>();

        foreach (XmlNode bbXmlNode in bbXmlNodes)
        {
            WMSBoundingBox boundingBox = new WMSBoundingBox();

            boundingBox.SRS = bbXmlNode.Attributes ["SRS"].InnerText;
            boundingBox.bottomLeftCoordinates.x = float.Parse(bbXmlNode.Attributes ["minx"].InnerText);
            boundingBox.bottomLeftCoordinates.y = float.Parse(bbXmlNode.Attributes ["miny"].InnerText);
            boundingBox.topRightCoordinates.x   = float.Parse(bbXmlNode.Attributes ["maxx"].InnerText);
            boundingBox.topRightCoordinates.y   = float.Parse(bbXmlNode.Attributes ["maxy"].InnerText);

            boundingBoxes.Add(boundingBox);
        }

        return(boundingBoxes);
    }
Пример #2
0
    private void DisplayBoundingBoxSelector(ref WMSTexture wmsTexture, WMSInfo wmsInfo, out bool boundingBoxChanged)
    {
        boundingBoxChanged = false;

        List <string> boundingBoxesNames = wmsInfo.GetBoundingBoxesNames(wmsTexture.selectedLayers).ToList();

        boundingBoxesNames.Insert(0, "Select bounding box from server");

        if (boundingBoxesNames.Count > 1)
        {
            int newBoundingBoxIndex =
                EditorGUILayout.Popup(
                    "BBs from server",
                    0,
                    boundingBoxesNames.ToArray()
                    ) - 1;

            boundingBoxChanged = (newBoundingBoxIndex != -1);

            if (boundingBoxChanged)
            {
                wmsTexture.SRS = wmsInfo.GetBoundingBox(wmsTexture.selectedLayers, newBoundingBoxIndex).SRS;
                WMSBoundingBox currentBoundingBox = wmsInfo.GetBoundingBox(wmsTexture.selectedLayers, newBoundingBoxIndex);

                wmsTexture.bottomLeftCoordinates = currentBoundingBox.bottomLeftCoordinates;
                wmsTexture.topRightCoordinates   = currentBoundingBox.topRightCoordinates;

                wmsTexture.RequestTexturePreview();
            }
            else
            {
                if (wmsTexture.selectedLayers.Count == 1)
                {
                    // If we have one layer selected, use the SRS of its first bounding box.
                    wmsTexture.SRS = wmsInfo.GetBoundingBox(wmsTexture.selectedLayers, 0).SRS;
                }
            }
        }
    }