static void expectRelation(IGeometry a, IGeometry b, GeometryRelation expected)
        {
            var actual = a.Compare(b);

            if (actual != expected)
            {
                throw new Exception("Expeted relation {0}, but is {1}".format(expected, actual));
            }
        }
示例#2
0
        public bool isCrossed(TLines yline)
        {
            GeometryRelation GetResult = curGeometry.Compare(yline.curGeometry);

            if (GetResult != GeometryRelation.Disjoint && GetResult != GeometryRelation.Unknown)
            {
                return(true);
            }
            return(false);
        }
示例#3
0
        public bool PickUp(RectangleGeometry _Ref)//判断是否框选中,
        {
            IsSelected = false;
            GeometryRelation GetResult = curGeometry.Compare(_Ref);

            if (GetResult != GeometryRelation.Disjoint && GetResult != GeometryRelation.Unknown)
            {
                IsSelected = true;
                return(true);
            }
            return(false);
        }
    /// <summary>
    /// This method purely uses the WPF SDK to query for features based on the given GeometryRelation
    /// </summary>
    private async Task SelectUsingRelation(GeometryRelation relation)
    {
      IList<Graphic> TargetFeatures = new List<Graphic>();

      foreach (OpsDashboard.DataSource targetDataSource in TargetDataSources)
      {
        FeatureLayer targetLayer = MapWidget.FindFeatureLayer(targetDataSource);
        if (targetLayer == null)
          return;

        targetLayer.ClearSelection();
        TargetFeatures = targetLayer.Graphics;

        //Both TargetFeatures and SourceFeatures are assumed to be in the same spatial reference. The relations are evaluated in 2D. 
        RelationResult result = await geometryService.RelationTaskAsync(TargetFeatures, SourceFeatures.ToList(), relation, null);

        var results = result.Results;
        if ((result == null) || (result.Results == null) || (result.Results.Count < 1))
          continue;

        //Clear any features that are currently selected
        targetLayer.ClearSelection();

        foreach (GeometryRelationPair pair in results)
        {
          //Graphic1 is the target feature, graphic 2 is the source feature
          if (pair == null)
            continue;

          Graphic actualFeature = TargetFeatures[pair.Graphic1Index];
          if (actualFeature == null)
            continue;
          else
            actualFeature.Select();
        }
      }
    }   
 static void expectRelation(IGeometry a, IGeometry b, GeometryRelation expected)
 {
     var actual = a.Compare(b);
     if (actual != expected)
         throw new Exception("Expeted relation {0}, but is {1}".format(expected, actual));
 }