public DatasourceInput(string filename) { // TODO: datasource must be closed in case of OGR layers var identity = new LayerIdentity(filename); var ds = GeoSource.OpenFromIdentity(identity); Datasource = ds.GetLayers().FirstOrDefault(); }
public bool IsParentOf(LayerIdentity identity) { if (identity.IdentityType != LayerIdentityType.File) { return(false); } return(Shared.PathHelper.IsParentOf(GetPath(), identity.Filename)); }
public DatasourcePointer(LayerIdentity identity) { if (identity == null) { throw new ArgumentNullException("identity"); } LayerIdentity = identity; LayerHandle = -1; _name = Path.GetFileNameWithoutExtension(identity.Filename); }
public bool IsParentOf(LayerIdentity identity) { if (identity.IdentityType != LayerIdentityType.OgrDatasource) { return(false); } // it may be trickier than that since items in connection string // aren't necessarily in the same order return(Connection.ConnectionString.EqualsIgnoreCase(identity.Connection)); }
public static IDatasource OpenFromIdentity(LayerIdentity identity) { switch (identity.IdentityType) { case LayerIdentityType.File: return(Open(identity.Filename)); case LayerIdentityType.OgrDatasource: return(OpenFromDatabase(identity.Connection, identity.Query)); default: throw new ArgumentOutOfRangeException(); } }
private bool AddWmsLayer(LayerIdentity identity) { if (identity.IdentityType == LayerIdentityType.Wms) { var wms = new WmsSource("") { BaseUrl = identity.Connection, Layers = identity.Query }; // TODO: we don't notify plugin about it, perhaps we should int layerHandle = _context.Map.Layers.Add(wms); if (layerHandle != -1) { _lastLayerHandle = layerHandle; return(true); } } return(false); }
public bool RemoveLayer(LayerIdentity identity) { var layers = _context.Map.Layers.Where(l => l.Identity == identity); BeginBatch(); bool result = false; foreach (var l in layers) { if (!RemoveLayerCore(l.Handle, true)) { result = false; break; } result = true; } EndBatch(); return(result); }
public bool AddLayerIdentity(LayerIdentity identity) { if (identity == null) { return(false); } switch (identity.IdentityType) { case LayerIdentityType.File: return(AddLayersFromFilenameCore(identity.Filename)); case LayerIdentityType.OgrDatasource: return(AddDatabaseLayer(identity.Connection, identity.Query, identity.GeometryType)); case LayerIdentityType.Wms: return(AddWmsLayer(identity)); default: Logger.Current.Warn("Unexpected layer identity"); return(false); } }
public bool IsParentOf(LayerIdentity identity) { return(false); }
public DatasourcePointer(string filename) { LayerIdentity = new LayerIdentity(filename); LayerHandle = -1; _name = Path.GetFileNameWithoutExtension(filename); }