private void featureType_ProcessCompleted(object sender, ResultEventArgs<Dictionary<string, List<WFSFeatureDescription>>> e) { foreach (var item in e.Result) { if (item.Key == "http://www.supermap.com/World") { GetWFSFeature getWFSFeature = new GetWFSFeature(url) { MaxFeatures = 5, FeatureNS = item.Key }; WFSFeatureDescription typeCountries = new WFSFeatureDescription { TypeName = item.Value[0].TypeName, SpatialProperty = item.Value[0].SpatialProperty, }; typeCountries.Properties.Add("COUNTRY"); typeCountries.Properties.Add("CAPITAL"); getWFSFeature.FeatureDescriptions.Add(typeCountries); getWFSFeature.ProcessAsync(); getWFSFeature.ProcessCompleted += new EventHandler<ResultEventArgs<GetWFSFeatureResult>>(getWFSFeature_ProcessCompleted); getWFSFeature.Failed += new EventHandler<FailedEventArgs>(ServiceError_Failed); } } }
private void getFeatureByID_Click(object sender, RoutedEventArgs e) { //GetWFSFeatureByIDs getserver = new GetWFSFeatureByIDs("http://localhost:8090/iserver/services/data-world/wfs100"); //var type1 = new LayerType //{ // TypeName = "World:Capitals", // SpacialProperty = "the_geom" //}; //type1.IDs.Add("World.Capitals.90"); //type1.Properties.Add("SMY"); //type1.Properties.Add("SMX"); ////type1.Properties.Add("the_geom"); GetWFSFeature getserver = new GetWFSFeature("http://localhost:8090/iserver/services/data-world/wfs100") { //MaxFeatures = 10, }; //getserver.FeatureIDs.Add("World.Capitals.90"); //getserver.FeatureIDs.Add("World.Countries.196"); //var type1 = new LayerType //{ // TypeName = "World:Capitals", // SpacialProperty = "the_geom" //}; //type1.Properties.Add("SMY"); //type1.Properties.Add("SMX"); var type2 = new WFSFeatureDescription { TypeName = "World:Countries", SpatialProperty = "the_geom" }; type2.Properties.Add("SMY"); type2.Properties.Add("SMX"); //getserver.LayerType.Add(type1); getserver.FeatureDescriptions.Add(type2); getserver.FeatureNS = "http://www.supermap.com/World"; getserver.ProcessAsync(); getserver.ProcessCompleted += new EventHandler<ResultEventArgs<GetWFSFeatureResult>>(getserver_ProcessCompleted); }
private void Filter_Click(object sender, RoutedEventArgs e) { GetWFSFeature getFilter = new GetWFSFeature("http://localhost:8090/iserver/services/data-world/wfs100"); getFilter.FeatureNS = "http://www.supermap.com/World"; var type1 = new WFSFeatureDescription { TypeName = "World:Countries" }; getFilter.FeatureDescriptions.Add(type1); Logical f1 = new Logical { Type = LogicalType.Not, Filters = { new Logical { Type = LogicalType.And, Filters = { new Comparison { Type = ComparisonType.LessThan, Expressions= { new Arithmetic { PropertyNames={"SMSDRIW","SMSDRIN"}, Type=ArithmeticType.Mul }, new Arithmetic { PropertyNames={"SmID","COLOR_MAP"}, Type=ArithmeticType.Div } } }, new Logical { Type = LogicalType.And, Filters = { new Comparison { PropertyNames = { "SQKM" }, Type = ComparisonType.GreaterThan, Value = "800000" }, new Logical { Type = LogicalType.Not , Filters= { new Comparison { PropertyNames = { "Capital" }, Type = ComparisonType.Null } } } } } } } } }; Comparison f2 = new Comparison { Type = ComparisonType.LessThan, Expressions = {new Arithmetic{ PropertyNames = { "SMSDRIW", "SMSDRIN" }, Type = ArithmeticType.Mul }, new Arithmetic { PropertyNames = { "SmID", "COLOR_MAP" }, Type = ArithmeticType.Div } } }; Comparison f3 = new Comparison { Type = ComparisonType.GreaterThan, PropertyNames = { "SQKM" }, Expressions = { new Arithmetic { Type= ArithmeticType.Sub, Expressions={ new Arithmetic { Type=ArithmeticType.Mul, PropertyNames= {"SMSDRIW","SMSDRIN"} }, new Arithmetic { Type=ArithmeticType.Div, PropertyNames={"SmID","COLOR_MAP"} } } } } }; Comparison f4 = new Comparison { Type = ComparisonType.Between, PropertyNames = { "SmID" }, Expressions = { new Arithmetic{ Value="100"}, new Arithmetic{ Value="110"}, } }; Comparison f5 = new Comparison { Type = ComparisonType.Between, Expressions = { new Arithmetic { PropertyNames={"SmID"}, Type=ArithmeticType.Add, Value="10" }, new Arithmetic{ Value="100"}, new Arithmetic{ Value="110"}, } }; //(SQKM > 8000000) && (Capition!=null) && (SmArea/2 > 1000) Logical f6 = new Logical { Type = LogicalType.And, Filters = { new Comparison { Type=ComparisonType.GreaterThan, Value="8000000", PropertyNames={"SQKM"} }, new Logical { Type=LogicalType.And, Filters= { new Comparison { Type=ComparisonType.Null, PropertyNames={"Capition"} }, new Comparison { Type=ComparisonType.GreaterThan, Expressions= { new Arithmetic { PropertyNames={"SmArea"}, Type=ArithmeticType.Div, Value="2" }, }, Value="1000" } } } } }; // ((8000000 <= SQKM <= 10000000) && (Capital = "华盛顿")) || (Country != "加拿大") Logical f7 = new Logical { Type = LogicalType.Or, Filters = { new Logical { Type = LogicalType.And, Filters= { new Comparison { Type=ComparisonType.Between, PropertyNames={"SQKM"}, Expressions= { new Arithmetic{ Value="8000000"}, new Arithmetic{Value="10000000"} } }, new Comparison { PropertyNames = {"Capital"}, Type = ComparisonType.EqualTo, Value="华盛顿" } } }, new Comparison { PropertyNames = {"Country"}, Type = ComparisonType.NotEqualTo, Value = "加拿大" } } }; //(SQKM < 10) && (Country Like "直布%") or ((SQKM * 2) > 10) Logical f8 = new Logical { Type = LogicalType.Or, Filters = { new Logical { Type = LogicalType.And, Filters= { new Comparison { PropertyNames = {"SQKM"}, Type = ComparisonType.LessThan, Value = "10" }, new Comparison { Type = ComparisonType.Like, PropertyNames = {"Country"}, Value = "直布%" } } }, new Comparison { Type = ComparisonType.GreaterThan, Expressions = { new Arithmetic { Type = ArithmeticType.Mul, PropertyNames = {"SQKM"}, Value = "2" } }, Value = "10" } } }; //(SQKM <= 10) && ((SQKM + SQMI) >10) or((SQKM + SQMI)<1) Logical f9 = new Logical { Type = LogicalType.Or, Filters = { new Logical { Type = LogicalType.And, Filters= { new Comparison { Type = ComparisonType.LessThanOrEqualTo, PropertyNames = {"SQKM"}, Value = "10" }, new Comparison { Type = ComparisonType.GreaterThan, Expressions = { new Arithmetic { PropertyNames = {"SQKM","SQMI"}, Type = ArithmeticType.Add } }, Value = "10" } } }, new Comparison { Type = ComparisonType.LessThan, Expressions = { new Arithmetic { PropertyNames = {"SQKM","SQMI"}, Type = ArithmeticType.Add } }, Value = "1" } } }; Logical f10 = new Logical { Type = LogicalType.And, Filters = { new Logical { Type = LogicalType.And, Filters= { new Logical { Type = LogicalType.And, Filters= { new SpatialRect { Type = SpatialType.BBOX, PropertyName = "World", Value = new Rectangle2D(100,-10,180,30) }, new SpatialGeometry { Type = SpatialType.Disjoint, PropertyName = "World", Value = new GeoRegion { Parts = { new Point2DCollection { new Point2D(100,-10), new Point2D(140,0) } } } } } }, new SpatialGeometry { Type = SpatialType.Intersects, PropertyName = "World", Value = new GeoRegion { Parts = { new Point2DCollection { new Point2D(160,10), new Point2D(180,20) } } } } } }, new SpatialGeometry { Type = SpatialType.Contains, PropertyName = "World", Value = new GeoPoint(166.62,19.3) } } }; Logical f11 = new Logical { Type = LogicalType.And, Filters = { new Logical { Type = LogicalType.And, Filters = { new SpatialGeometry { Type = SpatialType.Within, PropertyName = "Grids", Value = new GeoLine { Parts = { new Point2DCollection { new Point2D(-180,-90), new Point2D(-120,0) } } } }, new SpatialGeometry { Type = SpatialType.Crosses, PropertyName = "Grids", Value = new GeoLine { Parts = { new Point2DCollection { new Point2D(-180,-60), new Point2D(-160,-30), } } } } } }, new SpatialGeometry { Type = SpatialType.Overlaps, PropertyName = "Grids", Value = new GeoLine { Parts = { new Point2DCollection { new Point2D(-180,-30), new Point2D(-160,-45), } } } } } }; SpatialGeometry f12 = new SpatialGeometry { Type = SpatialType.Touches, PropertyName = "Grids", Value = new GeoLine { Parts = { new Point2DCollection { new Point2D(-180,-60), new Point2D(-160,-30), } } } }; SpatialGeometry f13 = new SpatialGeometry { Type = SpatialType.Equals, PropertyName = "Grids", Value = new GeoLine { Parts = { new Point2DCollection { new Point2D(-180,-90), new Point2D(-160,-90), } } } }; getFilter.Filters.Add(f4); getFilter.Filters.Add(f5); getFilter.ProcessAsync(); getFilter.ProcessCompleted += new EventHandler<ResultEventArgs<GetWFSFeatureResult>>(getFilter_ProcessCompleted); getFilter.Failed += new EventHandler<FailedEventArgs>(getFilter_Failed); }