public int NetworkClassId(string className) { if (_fdb == null || _dataset == null) { return(-1); } return(_fdb.FeatureClassID(_fdb.DatasetID(_dataset.DatasetName), className)); }
async public Task <int> NetworkClassId(string className) { if (_fdb == null || _dataset == null) { return(-1); } return(await _fdb.FeatureClassID(await _fdb.DatasetID(_dataset.DatasetName), className)); }
async public Task <IFeature> NextFeature() { if (_edgeCursor == null && _edgeFcs != null && _edgeFcIndex < _edgeFcs.Count) { IFeatureClass fc = _edgeFcs[_edgeFcIndex++]; _fcid = await _fdb.FeatureClassID(await _fdb.DatasetID(fc.Dataset.DatasetName), fc.Name); if (_fcid < 0) { return(await NextFeature()); } if (fc.Name == _networkName + "_ComplexEdges") { _fcid = -1; } IQueryFilter f = (IQueryFilter)_filter.Clone(); if (f.SubFields != "*") { f.AddField(fc.IDFieldName); f.AddField(fc.ShapeFieldName); } _edgeCursor = await fc.GetFeatures(f); if (_edgeCursor == null) { return(await NextFeature()); } } if (_edgeCursor != null) { IFeature feature = await _edgeCursor.NextFeature(); if (feature != null) { feature.Fields.Add(new FieldValue("NETWORK#FCID", _fcid)); return(feature); } _edgeCursor.Dispose(); _edgeCursor = null; return(await NextFeature()); } if (_nodeCursor == null && _nodeFc != null) { _nodeCursor = await _nodeFc.GetFeatures(_filter); } if (_nodeCursor != null) { return(await _nodeCursor.NextFeature()); } return(null); }
public bool Open() { if (_fdb == null) { return(false); } _dsID = _fdb.DatasetID(_dsname); if (_dsID < 0) { return(false); } _sRef = this.SpatialReference; _state = DatasetState.opened; _sIndexDef = _fdb.SpatialIndexDef(_dsID); return(true); }
async public Task <bool> Open() { if (_fdb == null) { return(false); } _dsID = await _fdb.DatasetID(_dsname); if (_dsID < 0) { return(false); } _sRef = await this.GetSpatialReference(); _state = DatasetState.opened; _sIndexDef = await _fdb.SpatialIndexDef(_dsID); return(true); }
public pgNetworkFeatureClass(pgFDB fdb, IDataset dataset, string name, GeometryDef geomDef) { _fdb = fdb; _fcid = _fdb.FeatureClassID(_fdb.DatasetID(dataset.DatasetName), name); _dataset = dataset; _geomDef = (geomDef != null) ? geomDef : new GeometryDef(); if (_geomDef != null && _geomDef.SpatialReference == null && dataset is IFeatureDataset) { _geomDef.SpatialReference = ((IFeatureDataset)dataset).SpatialReference; } _fields = new Fields(); _name = _aliasname = name; IDatasetElement element = _dataset[_name + "_Nodes"]; if (element != null) { _nodeFc = element.Class as IFeatureClass; } element = _dataset[_name + "_ComplexEdges"]; if (element != null && element.Class is IFeatureClass) { _edgeFcs.Add(-1, (IFeatureClass)element.Class); } DataTable tab = _fdb.Select("\"FCID\"", "\"FDB_NetworkClasses\"", "\"NetworkId\"=" + _fcid); if (tab != null && tab.Rows.Count > 0) { StringBuilder where = new StringBuilder(); where.Append("\"GeometryType\"=" + ((int)geometryType.Polyline).ToString() + " AND \"ID\" in("); for (int i = 0; i < tab.Rows.Count; i++) { if (i > 0) { where.Append(","); } where.Append(tab.Rows[i]["fcid"].ToString()); } where.Append(")"); tab = _fdb.Select("\"ID\",\"Name\"", "\"FDB_FeatureClasses\"", where.ToString()); if (tab != null) { foreach (DataRow row in tab.Rows) { element = _dataset[row["name"].ToString()]; if (element != null && element.Class is IFeatureClass) { _edgeFcs.Add((int)row["id"], element.Class as IFeatureClass); } } } } _weights = _fdb.GraphWeights(name); Dictionary <Guid, string> weightTableNames = null; Dictionary <Guid, GraphWeightDataType> weightDataTypes = null; if (_weights != null && _weights.Count > 0) { weightTableNames = new Dictionary <Guid, string>(); weightDataTypes = new Dictionary <Guid, GraphWeightDataType>(); foreach (IGraphWeight weight in _weights) { if (weight == null) { continue; } weightTableNames.Add(weight.Guid, _fdb.TableName(_name + "_Weights_" + weight.Guid.ToString("N").ToLower())); weightDataTypes.Add(weight.Guid, weight.DataType); } } _pageManager = new NetworkObjectSerializer.PageManager( gView.Framework.Db.DataProvider.PostgresProvider, _fdb.ConnectionString, _name, _fdb.TableName("FC_" + _name), _fdb.TableName(_name + "_Edges"), _fdb.TableName("FC_" + name + "_Nodes"), weightTableNames, weightDataTypes, _fdb ); }