static XmlElement encodeResource(XmlDocument doc, Resource resource) { XmlElement e = null; if (resource && resource.getResourceType() != FeatureLayerResource.getStaticResourceType()) { e = doc.CreateElement("", "resource", ""); e.SetAttribute("type", resource.getResourceType()); e.SetAttribute("name", resource.getName()); string tags; foreach (string it in resource.getTags()) { tags += it + " "; } if (!string.IsNullOrEmpty(tags)) { e.SetAttribute("tags", tags); } e.AppendChild(encodeURI(doc, resource.getURI())); foreach (Property it in resource.getProperties()) { e.AppendChild(encodeProperty(doc, it)); } if (resource.getResourceType() == SRSResource.getStaticResourceType()) { SRSResource srs = (SRSResource)resource; e.AppendChild(doc.CreateTextNode(srs.getSRS().getWKT())); } } return(e); }
static void parseSRSResource(XmlElement e, SRSResource resource) { if (resource.getSRS() == null) { string wkt = e.InnerText; if (!string.IsNullOrEmpty(wkt)) { resource.setSRS(Registry.SRSFactory().createSRSfromWKT(wkt)); } } }
static void parseSRSResource(XmlElement e, SRSResource resource) { if (resource.getSRS() == null) { string wkt = e.InnerText; if (!string.IsNullOrEmpty(wkt)) { SharpMapSpatialReferenceFactory shpsrsf = new SharpMapSpatialReferenceFactory(); SpatialReference srs = shpsrsf.createSRSfromWKT(wkt); resource.setSRS(srs); //resource.setSRS(Registry.SRSFactory().createSRSfromWKT(wkt)); } } }
static Terrain decodeTerrain(XmlElement e, Project proj) { Terrain terrain = null; if (e != null) { terrain = new Terrain(); terrain.setBaseURI(proj.getBaseURI()); terrain.setName(e.GetAttribute("name")); terrain.setURI(e.GetElementsByTagName("uri")[0].InnerText); SRSResource resource = findSRSResource(proj.getResources(), e.GetAttribute("srs")); if (resource != null) { terrain.setExplicitSRS(resource.getSRS()); } } return(terrain); }