public void BeginExecuteQueryBlockUntilDone() { MockRepository mocks = new MockRepository(); IFeatureProvider adapted = mocks.CreateMock <IFeatureProvider>(); IExtents iExtentsStub = MockRepository.GenerateStub <IExtents>(); FeatureQueryExpression featureQueryExpressionStub = MockRepository.GenerateStub <FeatureQueryExpression>(iExtentsStub, SpatialOperation.Intersects); _returnReaderStub = MockRepository.GenerateStub <IFeatureDataReader>(); _sleepInterval = 750; using (mocks.Unordered()) { Expect.Call(adapted.ExecuteFeatureQuery(featureQueryExpressionStub)) .Do(new ExecuteQueryDelegate(executeQueryMock)); } mocks.ReplayAll(); AsyncFeatureProviderAdapter adapter = new AsyncFeatureProviderAdapter(adapted); IAsyncResult ar = adapter.BeginExecuteQuery(featureQueryExpressionStub, null); Assert.NotNull(ar); Stopwatch timer = Stopwatch.StartNew(); Assert.Same(_returnReaderStub, adapter.EndExecuteQuery(ar)); timer.Stop(); Assert.True(ar.IsCompleted); Assert.False(ar.CompletedSynchronously); Assert.True(timer.ElapsedMilliseconds > 500L); mocks.VerifyAll(); }
protected override void IndexListChanged(Object sender, ListChangedEventArgs e) { switch (e.ListChangedType) { case ListChangedType.ItemAdded: FeatureDataRow feature = this[e.NewIndex].Row as FeatureDataRow; Debug.Assert(feature != null); if (_extents == null) { _extents = feature.Extents; } else { _extents.ExpandToInclude(feature.Extents); } break; case ListChangedType.Reset: case ListChangedType.ItemChanged: case ListChangedType.ItemDeleted: recomputeExtents(); break; default: break; } base.IndexListChanged(sender, e); }
/// <summary> /// The extents of the data source. /// </summary> /// <returns> /// An <see cref="IExtents"/> instance describing the extents of the /// data available in the data source. /// </returns> public override IExtents GetExtents() { if (_extents != null) { return(_extents); } if (_geometries.Count == 0) { _extents = _geoFactory.CreateExtents(); } else { foreach (IGeometry g in Geometries) { if (g.IsEmpty) { continue; } if (_extents == null) { _extents = g.Extents; } else { _extents.ExpandToInclude(g.Extents); } } } return(_extents); }
public void AddingRowToTableTriggersViewListChangedItemAddedNotification() { FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(_factories.GeoFactory); FeatureDataTable table = new FeatureDataTable(_factories.GeoFactory); IExtents halfBounds = data.GetExtents(); halfBounds.Scale(0.5); FeatureQueryExpression query = FeatureQueryExpression.Intersects(halfBounds); IFeatureDataReader reader = data.ExecuteFeatureQuery(query); table.Load(reader, LoadOption.OverwriteChanges, null); FeatureDataView view = new FeatureDataView(table); Boolean addNotificationOccured = false; view.ListChanged += delegate(Object sender, ListChangedEventArgs e) { if (e.ListChangedType == ListChangedType.ItemAdded) { addNotificationOccured = true; } }; FeatureDataRow row = table.NewRow(); row["Oid"] = Guid.NewGuid(); row["FeatureName"] = "New row"; row.Geometry = _factories.GeoFactory.CreatePoint2D(44, 44); table.AddRow(row); Assert.True(addNotificationOccured); }
public void MovingRowTriggersViewListChangedItemMovedNotification() { // TODO: implement MovingRowTriggersViewListChangedItemMovedNotification FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(_factories.GeoFactory); FeatureDataTable table = new FeatureDataTable(_factories.GeoFactory); IExtents halfBounds = data.GetExtents(); halfBounds.Scale(0.5); FeatureQueryExpression query = FeatureQueryExpression.Intersects(data.GetExtents()); IFeatureDataReader reader = data.ExecuteFeatureQuery(query); table.Load(reader, LoadOption.OverwriteChanges, null); FeatureDataView view = new FeatureDataView(table); Boolean addNotificationOccured = false; view.ListChanged += delegate(Object sender, ListChangedEventArgs e) { if (e.ListChangedType == ListChangedType.ItemMoved) { addNotificationOccured = true; } }; Assert.True(addNotificationOccured); }
private static void filterSelected(ILayer layer, IMapView2D view, IExtents worldBounds) { if (layer == null) { return; } FeatureLayer filterLayer = layer as FeatureLayer; if (filterLayer != null) { if (layer.Enabled && filterLayer.AreFeaturesSelectable && layer.IsVisibleWhen(isInView(view.WorldWidth))) { SpatialBinaryExpression spatialExpression = SpatialBinaryExpression.Intersects(new FeaturesCollectionExpression(filterLayer.Features), new ExtentsExpression(worldBounds)); filterLayer.SelectedFilter = filterLayer.SelectedFilter == null ? new FeatureQueryExpression(new AllAttributesExpression(), spatialExpression, null) : new FeatureQueryExpression(filterLayer.SelectedFilter, spatialExpression); } } IEnumerable <ILayer> layers = layer as IEnumerable <ILayer>; if (layers != null) { foreach (ILayer child in layers) { filterSelected(child, view, worldBounds); } } }
public void ChangeViewSpatialFilterTriggersNotification() { FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(_factories.GeoFactory); FeatureDataTable table = new FeatureDataTable(_factories.GeoFactory); FeatureQueryExpression query = FeatureQueryExpression.Intersects(data.GetExtents()); IFeatureDataReader reader = data.ExecuteFeatureQuery(query); table.Load(reader, LoadOption.OverwriteChanges, null); FeatureDataView view = new FeatureDataView(table); Boolean resetNotificationOccured = false; view.ListChanged += delegate(Object sender, ListChangedEventArgs e) { if (e.ListChangedType == ListChangedType.Reset) { resetNotificationOccured = true; } }; Assert.False(resetNotificationOccured); IExtents queryExtents = _factories.GeoFactory.CreateExtents2D(0, 0, 10, 10); SpatialBinaryExpression expression = SpatialBinaryExpression.Intersects(queryExtents); view.SpatialFilter = expression; Assert.True(resetNotificationOccured); }
public void Insert(IExtents bounds, TItem entry, ISpatialIndexNode <IExtents, TItem> node, INodeSplitStrategy <IExtents, TItem> nodeSplitStrategy, IndexBalanceHeuristic heuristic, out ISpatialIndexNode <IExtents, TItem> newSiblingFromSplit) { if (node == null) { throw new ArgumentNullException("node"); } if (!(node is QuadTreeNode <TItem>)) { throw new ArgumentException("Parameter 'node' must be of type QuadTreeNode<TItem>", "node"); } QuadTreeNode <TItem> quadTreeNode = node as QuadTreeNode <TItem>; insertEntryRecursive(quadTreeNode, entry, nodeSplitStrategy, heuristic, out newSiblingFromSplit); if (newSiblingFromSplit != null) { if (quadTreeNode.ItemCount == 4) { throw new QuadTreeIndexInsertOverflowException(); } quadTreeNode.Add(newSiblingFromSplit); } }
public void RenderFeatureTest() { IFeatureProvider provider = DataSourceHelper.CreateGeometryDatasource(_factories.GeoFactory); TestVectorRenderer vectorRenderer = new TestVectorRenderer(); BasicGeometryRenderer2D <RenderObject> geometryRenderer = new BasicGeometryRenderer2D <RenderObject>(vectorRenderer); FeatureDataTable features = new FeatureDataTable(_factories.GeoFactory); IExtents extents = provider.GetExtents(); FeatureQueryExpression query = new FeatureQueryExpression(extents.ToGeometry(), SpatialOperation.Intersects, provider); features.Merge(provider.ExecuteFeatureQuery(query) as IEnumerable <IFeatureDataRecord>, provider.GeometryFactory); foreach (FeatureDataRow feature in features) { IGeometry g = feature.Geometry; List <RenderObject> renderedObjects = new List <RenderObject>(geometryRenderer.RenderFeature(feature)); for (Int32 i = 0; i < renderedObjects.Count; i++) { RenderObject ro = renderedObjects[i]; } } }
public void BeginExecuteQueryCallBackNotification() { CallBackHelper callBackRecorder = new CallBackHelper(); MockRepository mocks = new MockRepository(); IRasterProvider adapted = mocks.CreateMock <IRasterProvider>(); IExtents iExtentsStub = MockRepository.GenerateStub <IExtents>(); RasterQueryExpression RasterQueryExpressionStub = MockRepository.GenerateStub <RasterQueryExpression>(iExtentsStub, SpatialOperation.Intersects); _returnStreamStub = MockRepository.GenerateStub <Stream>(); _sleepInterval = 500; using (mocks.Unordered()) { Expect.Call(adapted.ExecuteRasterQuery(RasterQueryExpressionStub)) .Do(new ExecuteQueryDelegate(executeQueryMock)); } mocks.ReplayAll(); AsyncRasterProviderAdapter adapter = new AsyncRasterProviderAdapter(adapted); IAsyncResult ar = adapter.BeginExecuteQuery(RasterQueryExpressionStub, callBackRecorder.CallBack); Assert.NotNull(ar); Assert.False(ar.IsCompleted); Thread.Sleep(1000); Assert.Same(ar, callBackRecorder.Result); Assert.True(ar.IsCompleted); Assert.Same(_returnStreamStub, adapter.EndExecuteQuery(ar)); mocks.VerifyAll(); }
private static ISpatialIndexNode <IExtents, TItem> findNodeForItem(TItem item, ISpatialIndexNode <IExtents, TItem> node) { foreach (TItem nodeItem in node.Items) { if (item.Equals(nodeItem)) { return(node); } } IExtents itemBounds = item.Bounds; // TODO: I think a breadth-first search would be more efficient here foreach (ISpatialIndexNode <IExtents, TItem> child in node.SubNodes) { if (child.Intersects(itemBounds)) { ISpatialIndexNode <IExtents, TItem> found = findNodeForItem(item, child); if (found != null) { return(found); } } } return(null); }
public void BeginExecuteQueryPollingNotification() { MockRepository mocks = new MockRepository(); IFeatureProvider adapted = mocks.CreateMock <IFeatureProvider>(); IExtents iExtentsStub = MockRepository.GenerateStub <IExtents>(); FeatureQueryExpression featureQueryExpressionStub = MockRepository.GenerateStub <FeatureQueryExpression>(iExtentsStub, SpatialOperation.Intersects); _returnReaderStub = MockRepository.GenerateStub <IFeatureDataReader>(); _sleepInterval = 1000; using (mocks.Unordered()) { Expect.Call(adapted.ExecuteFeatureQuery(featureQueryExpressionStub)) .Do(new ExecuteQueryDelegate(executeQueryMock)); } mocks.ReplayAll(); AsyncFeatureProviderAdapter adapter = new AsyncFeatureProviderAdapter(adapted); IAsyncResult ar = adapter.BeginExecuteQuery(featureQueryExpressionStub, null); Assert.NotNull(ar); Assert.False(ar.IsCompleted); while (!ar.IsCompleted) { Thread.Sleep(350); } Assert.True(ar.IsCompleted); Assert.Same(_returnReaderStub, adapter.EndExecuteQuery(ar)); mocks.VerifyAll(); }
private static ISpatialIndexNode <IExtents, TItem> findParentNode(ISpatialIndexNode <IExtents, TItem> lookFor, ISpatialIndexNode <IExtents, TItem> searchNode) { foreach (ISpatialIndexNode <IExtents, TItem> node in searchNode.SubNodes) { if (node.Equals(lookFor)) { return(searchNode); } } IExtents itemBounds = lookFor.Bounds; // TODO: I think a breadth-first search would be more efficient here foreach (ISpatialIndexNode <IExtents, TItem> child in searchNode.SubNodes) { if (child.Intersects(itemBounds)) { ISpatialIndexNode <IExtents, TItem> found = findParentNode(lookFor, child); if (found != null) { return(found); } } } return(null); }
/// <summary> /// Creates a new index branch node with the given extents. /// </summary> /// <returns>A new branch node for the R-Tree.</returns> protected internal virtual RTreeNode <TItem> CreateNode(int level, IExtents extents) { RTreeNode <TItem> node = CreateNode(level); node.Bounds = extents; return(node); }
public RasterQueryExpression(IExtents extents, SpatialOperation op) : base(new AllBandsExpression(), new SpatialBinaryExpression(new ExtentsExpression(extents), op, new ThisExpression())) { checkOp(op); }
private void onSpatialReferenceChanged() { _geoFactory = _geoFactory.Clone(); _geoFactory.SpatialReference = SpatialReference; foreach (ILayer layer in _layers) { if (!layer.SpatialReference.EqualParams(SpatialReference)) { if (layer.CoordinateTransformation != null) { // TODO: do we ever need to support multiple transforms? throw new InvalidOperationException("The layer already has a coordinate transform."); } layer.CoordinateTransformation = CoordinateTransformFactory.CreateFromCoordinateSystems(layer.SpatialReference, SpatialReference); } } _extents = null; raisePropertyChanged(SpatialReferenceProperty.Name); }
public IEnumerable <TResult> Query <TResult>(IExtents query, Func <TItem, TResult> selector) { foreach (TItem item in Query(query)) { yield return(selector(item)); } }
public void TestGetExtentsByOid() { GeometryServices services = new GeometryServices(); MsSqlServer2008Provider <long> search = new MsSqlServer2008Provider <long>(services.DefaultGeometryFactory, ConfigurationManager. ConnectionStrings["sql2008"]. ConnectionString, "dbo", "vw_iMARS_BRANCH", "ACSId", "Geom") { DefaultProviderProperties = new ProviderPropertiesExpression( new ProviderPropertyExpression[] { new WithNoLockExpression(true), new ForceIndexExpression(true) }) }; IExtents extents = search.GetExtentsByOid(1); Assert.IsNotNull(extents); Assert.IsFalse(extents.IsEmpty); }
public void IFeatureProviderMethodsPassThroughAdapter() { MockRepository mocks = new MockRepository(); IFeatureProvider adapted = mocks.CreateMock <IFeatureProvider>(); IGeometryFactory iGeometryFactoryStub = MockRepository.GenerateStub <IGeometryFactory>(); FeatureDataTable featureDataTableStub = MockRepository.GenerateStub <FeatureDataTable>(iGeometryFactoryStub); IFeatureDataReader iFeatureDataReaderStub = MockRepository.GenerateStub <IFeatureDataReader>(); IExtents iExtentsStub = MockRepository.GenerateStub <IExtents>(); FeatureQueryExpression featureQueryExpressionStub = MockRepository.GenerateStub <FeatureQueryExpression>(iExtentsStub, SpatialOperation.Intersects); FeatureQueryExecutionOptions featureQueryExecutionOptionsStub = new FeatureQueryExecutionOptions(); DataTable dataTableStub = MockRepository.GenerateStub <DataTable>(); CultureInfo cultureInfoStub = MockRepository.GenerateStub <CultureInfo>(1); using (mocks.Unordered()) { Expect.Call(adapted.CreateNewTable()) .Return(featureDataTableStub); Expect.Call(adapted.ExecuteFeatureQuery(featureQueryExpressionStub, featureQueryExecutionOptionsStub)) .Return(iFeatureDataReaderStub); Expect.Call(adapted.ExecuteFeatureQuery(featureQueryExpressionStub)) .Return(iFeatureDataReaderStub); adapted.GeometryFactory = iGeometryFactoryStub; Expect.Call(adapted.GeometryFactory) .Return(iGeometryFactoryStub); Expect.Call(adapted.GetFeatureCount()) .Return(3); Expect.Call(adapted.GetSchemaTable()) .Return(dataTableStub); Expect.Call(adapted.Locale) .Return(cultureInfoStub); adapted.SetTableSchema(featureDataTableStub); } mocks.ReplayAll(); AsyncFeatureProviderAdapter adapter = new AsyncFeatureProviderAdapter(adapted); Assert.Same(featureDataTableStub, adapter.CreateNewTable()); Assert.Same(iFeatureDataReaderStub, adapter.ExecuteFeatureQuery(featureQueryExpressionStub, featureQueryExecutionOptionsStub)); Assert.Same(iFeatureDataReaderStub, adapter.ExecuteFeatureQuery(featureQueryExpressionStub)); adapter.GeometryFactory = iGeometryFactoryStub; Assert.Same(iGeometryFactoryStub, adapter.GeometryFactory); Assert.Equal(3, adapter.GetFeatureCount()); Assert.Same(dataTableStub, adapter.GetSchemaTable()); Assert.Same(cultureInfoStub, adapter.Locale); adapter.SetTableSchema(featureDataTableStub); mocks.VerifyAll(); }
public FeatureQueryExpression(IExtents extents, SpatialOperation op, IEnumerable <IFeatureDataRecord> features) : base(new AllAttributesExpression(), new SpatialBinaryExpression(new ExtentsExpression(extents), op, new FeaturesCollectionExpression(features))) { }
public void Add(IExtents tileBounds, Bitmap tile) { QuadTreeNode <Bitmap> tileNode = new QuadTreeNode <Bitmap>(); tileNode.Value = tile; #warning This doesn't compile in Orcas B2, but it does in VS2005 //tileNode.BoundingBox = tileBounds; AddItem(tileNode); }
public ExtentsExpression(IExtents extents) { if (extents == null) { throw new ArgumentNullException("extents"); } _extents = extents; }
public IEnumerable <TItem> Query(IExtents query, Predicate <TItem> predicate) { foreach (TItem item in Query(query)) { if (predicate(item)) { yield return(item); } } }
public void GetExtentsTest() { ShapeFileProvider shapeFile = new ShapeFileProvider(BcRoadsShapeFile, _geoFactory); IExtents expected = _geoFactory.CreateExtents2D( 7332083.2127965018, 236823.71867240831, 7538428.618, 405610.34692560317); IExtents actual = shapeFile.GetExtents(); Assert.AreEqual(expected, actual); }
public IEnumerable <TItem> Query(IExtents bounds, Predicate <TItem> predicate) { foreach (TItem item in IntersectTreeRecursive(bounds, Root as RTreeNode <TItem>)) { if (predicate(item)) { yield return(item); } } }
public void IProviderMethodsPassThroughAdapter() { MockRepository mocks = new MockRepository(); IRasterProvider adapted = mocks.CreateMock <IRasterProvider>(); ICoordinateTransformation transformStub = MockRepository.GenerateStub <ICoordinateTransformation>(); Expression queryStub = MockRepository.GenerateStub <Expression>(); Object objectStub = MockRepository.GenerateStub <Object>(); IExtents extentsStub = MockRepository.GenerateStub <IExtents>(); ICoordinateSystem coordinateSystemStub = MockRepository.GenerateStub <ICoordinateSystem>(); using (mocks.Unordered()) { adapted.Close(); Expect.Call(adapted.ConnectionId) .Return("connectionid"); adapted.CoordinateTransformation = transformStub; Expect.Call(adapted.CoordinateTransformation) .Return(transformStub); Expect.Call(adapted.ExecuteQuery(queryStub)) .Return(objectStub); Expect.Call(adapted.GetExtents()) .Return(extentsStub); Expect.Call(adapted.IsOpen) .Return(true); adapted.Open(); Expect.Call(adapted.SpatialReference) .Return(coordinateSystemStub); //adapted.Srid = 1; Expect.Call(adapted.Srid) .Return("2"); } mocks.ReplayAll(); AsyncRasterProviderAdapter adapter = new AsyncRasterProviderAdapter(adapted); adapter.Close(); Assert.Equal("connectionid", adapter.ConnectionId); adapter.CoordinateTransformation = transformStub; Assert.Same(transformStub, adapter.CoordinateTransformation); Assert.Same(objectStub, adapter.ExecuteQuery(queryStub)); Assert.Same(extentsStub, adapter.GetExtents()); Assert.True(adapter.IsOpen); adapter.Open(); Assert.Same(coordinateSystemStub, adapter.SpatialReference); //adapter.Srid = 1; Assert.Equal("2", adapter.Srid); mocks.VerifyAll(); }
public void MapExtentsReflectTheUnderlyingLayersCorrectlyWhenUsingAddLayer() { Map map = new Map(_factories.GeoFactory); GeometryLayer layer = new GeometryLayer("Geom layer", DataSourceHelper.CreateGeometryDatasource(_factories.GeoFactory)); map.AddLayer(layer); IExtents box = map.Extents; Assert.Equal(_factories.GeoFactory.CreateExtents2D(0, 0, 120, 100), box); }
public ComputationExtents(IExtents extents) { if (extents == null) throw new ArgumentNullException("extents"); ICoordinate min = extents.Min; ICoordinate max = extents.Max; XMin = min[Ordinates.X]; YMin = min[Ordinates.Y]; XMax = max[Ordinates.X]; YMax = max[Ordinates.Y]; _hasValue = 1; }
public void EmptyMapDefaultsAreCorrect() { Map map = new Map(_factories.GeoFactory); IExtents emptyExtents = _factories.GeoFactory.CreateExtents(); IPoint emptyPoint = _factories.GeoFactory.CreatePoint(); Assert.Equal(emptyExtents, map.Extents); // changed to null from Point.Empty Assert.Equal(emptyPoint.Coordinate, map.Center); Assert.NotNull(map.Layers); Assert.Equal(0, map.Layers.Count); Assert.Equal(StandardMapView2DMapTools.None, map.ActiveTool); Assert.NotNull(map.SelectedLayers); }
private IEnumerable <Bitmap> recursiveNodeSearch(IExtents searchBounds, QuadTreeNode <Bitmap> node) { // If search bounds are only partially by node bounds, then return node's value, // since successive searches will be incomplete. if (node.Bounds.Intersects(searchBounds) && !node.Bounds.Contains(searchBounds)) { yield return(node.Value); yield break; } // The node must cover the search bounds, so see if it has more than // one child node which intersects the search bounds. If so, then that must // be the best resolution tiles to satisfy the search request, as the bitmaps can // be resampled upward. If there is only one child, recurse downward on that child. Int32[] intersectNodes = new Int32[4]; Int32 intersectNodeIndex = -1; for (Int32 nodeIndex = 0; nodeIndex < node.ItemCount; nodeIndex++) { QuadTreeNode <Bitmap> testNode = Items[nodeIndex]; if (testNode.Bounds.Intersects(searchBounds)) { intersectNodes[++intersectNodeIndex] = nodeIndex; } } // This should not be possible with the first bounds-check in this function Debug.Assert(intersectNodeIndex > -1); // If more than one node intersects the searchBounds, we must be at the correct resolution. // Otherwise, keep searching down the index. if (intersectNodeIndex > 0) { foreach (Int32 nodeIndex in intersectNodes) { yield return(node.Items[nodeIndex].Value); } } else { foreach ( Bitmap tile in recursiveNodeSearch(searchBounds, node.Items[intersectNodes[intersectNodeIndex]])) { yield return(tile); } } }
public void LoadIntersectingLayerData(IExtents region) { if (region == null) { throw new ArgumentNullException("region"); } SpatialBinaryExpression exp = new SpatialBinaryExpression(new ExtentsExpression(region), SpatialOperation.Intersects, new LayerExpression(this)); QueryExpression query = GetQueryFromSpatialBinaryExpression(exp); LoadLayerData(query); }
protected override void ReadV8(ByteReader reader) { base.ReadV8(reader); PartitionFlags = reader.ReadI32(); FileName = reader.ReadMbString(); // Read the box either way, if the mask is set, this is a reserved field...do we ignore it? TransformedBoundingBox = reader.ReadBBoxF32(); Area = reader.ReadF32(); MinVertexCount = reader.ReadI32(); MaxVertexCount = reader.ReadI32(); MinNodeCount= reader.ReadI32(); MaxNodeCount = reader.ReadI32(); MinPolygonCount = reader.ReadI32(); MaxPolygonCount = reader.ReadI32(); if ( ( PartitionFlags & 0x00000001 ) != 0 ) { UnTransformedBoundingBox = reader.ReadBBoxF32(); } }
public IGeometry ToGeometry(IExtents envelopeInternal) { ICoordinate[] verticies = new ICoordinate[5]; ICoordinate min = envelopeInternal.Min; ICoordinate max = envelopeInternal.Max; verticies[0] = max; verticies[1] = CoordinateFactory.Create(min[Ordinates.X], max[Ordinates.Y]); verticies[2] = min; verticies[3] = CoordinateFactory.Create(max[Ordinates.X], min[Ordinates.Y]); verticies[4] = max; LinearRing ring = new LinearRing(verticies); ring.Factory = this; Polygon p = new Polygon(ring); p.Factory = this; return p; }
public IExtents CreateExtents(IExtents first) { return new Extents(this, first); }
public IExtents CreateExtents(IExtents first, IExtents second, IExtents third) { return new Extents(this, first, second, third); }
private static void filterSelected(ILayer layer, IMapView2D view, IExtents worldBounds) { if (layer == null) { return; } FeatureLayer filterLayer = layer as FeatureLayer; if (filterLayer != null) { if (layer.Enabled && filterLayer.AreFeaturesSelectable && layer.IsVisibleWhen(isInView(view.WorldWidth))) { SpatialBinaryExpression spatialExpression = SpatialBinaryExpression.Intersects(new FeaturesCollectionExpression(filterLayer.Features), new ExtentsExpression(worldBounds)); filterLayer.SelectedFilter = filterLayer.SelectedFilter == null ? new FeatureQueryExpression(new AllAttributesExpression(), spatialExpression, null) : new FeatureQueryExpression(filterLayer.SelectedFilter, spatialExpression); } } IEnumerable<ILayer> layers = layer as IEnumerable<ILayer>; if (layers != null) { foreach (ILayer child in layers) { filterSelected(child, view, worldBounds); } } }
protected override void ReadV8(ByteReader reader) { VersionNumber = reader.ReadI16(); UntransformedBoundingBox = reader.ReadBBoxF32(); }
public ExtentsExpression(IExtents extents) { if (extents == null) throw new ArgumentNullException("extents"); _extents = extents; }
private static void WriteExtents(StringBuilder sb, IExtents extents, string coordinateFormatString) { sb.Append("["); sb.AppendFormat( string.Format("{0},{1},{2},{3}", string.Format(CultureInfo.InvariantCulture.NumberFormat, coordinateFormatString, extents.Min[Ordinates.X]), string.Format(CultureInfo.InvariantCulture.NumberFormat, coordinateFormatString, extents.Min[Ordinates.Y]), string.Format(CultureInfo.InvariantCulture.NumberFormat, coordinateFormatString, extents.Max[Ordinates.X]), string.Format(CultureInfo.InvariantCulture.NumberFormat, coordinateFormatString, extents.Max[Ordinates.Y]))); sb.Append("]"); }
protected override void ReadV8(ByteReader reader) { base.ReadV8(reader); // Read the transformed box TransformedBoundingBox = reader.ReadBBoxF32(); // Read the untransformed box UntransformedBoundingBox = reader.ReadBBoxF32(); Area = reader.ReadF32(); MinVertexCount = reader.ReadI32(); MaxVertexCount = reader.ReadI32(); MinNodeCount= reader.ReadI32(); MaxNodeCount = reader.ReadI32(); MinPolygonCount = reader.ReadI32(); MaxPolygonCount = reader.ReadI32(); Size = reader.ReadI32(); CompressionLevel = reader.ReadF32(); }
internal GeometryDataReader(GeometryProvider provider, IExtents bounds) { _provider = provider; _bounds = bounds; }