एफ ******** स्थानिक संबंध में बग? (मैं नहीं कर रहा हूँ)


13

मैं ISpatialFilter.SpatialRelDescription की अपेक्षा करता हूं कि वह IRelationalOperator.Relation के साथ लगातार व्यवहार करेगा । हालाँकि, जब मैं नीचे दिए गए कोड को चलाता हूं, तो मुझे मिलता है:

    Total features : 44368
    Count1: 9 T********
    Count2: 9 T********
    Count1: 21 F********
    Count2: 44359 F********
    Count1: 1 ******F**
    Count2: 1 ******F**

क्या यह F********रिश्ते में एक बग है ?

private void TestSpatialFilter()
{
    IMxDocument mxdoc = ((IApplication)m_application).Document as IMxDocument;
    IFeatureLayer fLayer = mxdoc.FocusMap.get_Layer(0) as IFeatureLayer;
    IEnvelope env = ((IActiveView)mxdoc.FocusMap).Extent;
    env.Expand(0.5, 0.5, true);
    env.Project(((IGeoDataset)fLayer.FeatureClass).SpatialReference);
    Debug.Print("Total features : {0}", fLayer.FeatureClass.FeatureCount(null));
    IFeatureClass fc = fLayer.FeatureClass;
    string[] rels = { "T********", "F********", "******F**" };
    foreach (string rel in rels)
    {
        Debug.Print("Count1: {0} {1}", Count1(fc, env, rel), rel);
        Debug.Print("Count2: {0} {1}", Count2(fc, env, rel), rel);
    }
}

public static int Count1(IFeatureClass fc, IGeometry geom,  string relDescription)
{
    ISpatialFilter sf = new SpatialFilterClass();
    sf.SpatialRel = esriSpatialRelEnum.esriSpatialRelRelation;
    sf.SpatialRelDescription = relDescription;
    sf.Geometry = geom;
    int i = fc.FeatureCount(sf);
    Marshal.FinalReleaseComObject(sf);
    return i;
}
public static int Count2(IFeatureClass fc, IGeometry geom, string relDescription)
{
    int i = 0;
    string relation = String.Format("RELATE(G1,G2,'{0}')", relDescription);
    IRelationalOperator relOp = geom as IRelationalOperator;

    IFeatureCursor fCur = fc.Search(null, false);
    IFeature feat;
    while ((feat = fCur.NextFeature()) != null)
    {
        if(relOp.Relation(feat.Shape,relation))
            i++;
    }
    Marshal.FinalReleaseComObject(fCur);
    return i;
}

1
क्षमा करें,
— जियोस्पेशल

जवाबों:


3

यह थोड़ा अजीब लगता है। शायद यह केवल कुछ विशिष्ट संचालन के साथ परीक्षण किया गया था, Ex: Intersects, Disjoint, आदि? आपके लिए क्या FF*FF****(उलटा T********) करता है? मुझे याद है कि कुछ संस्करणों में काम नहीं करने के कारण यह मुझे आश्चर्यचकित नहीं करता है।


1
वह काम करने लगता है। यदि स्थानिक इतना विशेष है, तो यह सुनिश्चित लगता है कि इसे बेहतर क्यूए प्राप्त करना चाहिए।
— कर्क कुक्केंडल
हमारी साइट का प्रयोग करके, आप स्वीकार करते हैं कि आपने हमारी Cookie Policy और निजता नीति को पढ़ और समझा लिया है।
Licensed under cc by-sa 3.0 with attribution required.