public static MemoryDataSource FromXElement(XElement ele) { if (ele == null) { return(null); } string name = null; if (ele.Attribute("name") != null) { name = ele.Attribute("name").Value; } string shapetype = ele.Attribute("shapetype").Value; enumShapeType stype = enumShapeType.Point; foreach (enumShapeType st in Enum.GetValues(typeof(enumShapeType))) { if (st.ToString() == shapetype) { stype = st; break; } } MemoryDataSource ds = new MemoryDataSource(name, stype); if (ele.Element("ArgsOfLeveling") != null) { ds.SetArgOfLevel(ArgOfLeveling.FromXElement(ele.Element("ArgsOfLeveling"))); } return(ds); }
public static FileDataSource FromXElement(XElement ele) { if (ele == null) { return(null); } string name = null; if (ele.Attribute("name") != null) { name = ele.Attribute("name").Value; } string fileurl = ele.Attribute("fileurl").Value; string fname = MapFactory.GetFullFilename(fileurl); if (!File.Exists(fname)) { return(null); } FileDataSource ds = new FileDataSource(name, fname); if (ele.Element("ArgsOfLeveling") != null) { ds.SetArgOfLevel(ArgOfLeveling.FromXElement(ele.Element("ArgsOfLeveling"))); } return(ds); }
public static IServerDataSource FromXElement(XElement xele) { if (xele == null) { return(null); } string name = xele.Attribute("name").Value; string uri = xele.Attribute("uri").Value; InstanceIdentify instanceId = InstanceIdentify.FromXElement(xele.Element("InstanceIdentify")); FetClassIdentify fetclassId = FetClassIdentify.FromXElement(xele.Element("FetClassIdentify")); ServerDataSource ds = new ServerDataSource(name, uri, instanceId, fetclassId); if (xele.Element("ArgsOfLeveling") != null) { ds.SetArgOfLevel(ArgOfLeveling.FromXElement(xele.Element("ArgsOfLeveling"))); } return(ds); }
public static SpatialDbDataSource FromXElement(XElement ele) { if (ele == null) { return(null); } string name = null; if (ele.Attribute("name") != null) { name = ele.Attribute("name").Value; } SpatialDbDataSource ds = new SpatialDbDataSource(name, ele.Attribute("connectionstring").Value); if (ele.Element("ArgsOfLeveling") != null) { ds.SetArgOfLevel(ArgOfLeveling.FromXElement(ele.Element("ArgsOfLeveling"))); } return(ds); }