示例#1
0
        /// <summary>
        /// This builds the _drawnStates based on the current label scheme.
        /// </summary>
        public virtual void CreateLabels()
        {
            if (FeatureSet != null)
            {
                if (FeatureSet.IndexMode)
                {
                    CreateIndexedLabels();
                    return;
                }
            }
            DrawnStates = new Dictionary <IFeature, LabelDrawState>();
            if (FeatureSet == null)
            {
                return;
            }
            //DataTable dt = _featureSet.DataTable; // if working correctly, this should auto-populate
            if (Symbology == null)
            {
                return;
            }

            foreach (ILabelCategory category in Symbology.Categories)
            {
                List <IFeature> features;
                if (!string.IsNullOrWhiteSpace(category.FilterExpression))
                {
                    features = FeatureSet.SelectByAttribute(category.FilterExpression);
                }
                else
                {
                    features = FeatureSet.Features.ToList();
                }

                foreach (IFeature feature in features)
                {
                    if (DrawnStates.ContainsKey(feature))
                    {
                        DrawnStates[feature] = new LabelDrawState(category);
                    }
                    else
                    {
                        DrawnStates.Add(feature, new LabelDrawState(category));
                    }
                }
            }
        }
示例#2
0
        private IFeatureSet CorrectFeatures(IFeatureSet featureSet)
        {
            IFeatureSet corFeatureSet = featureSet;
            List <int>  corList       = new List <int>();

            for (int i = 0; i < featureSet.ShapeIndices.Count; i++)
            {
                try
                {
                    IFeature    feature      = featureSet.GetFeature(i);
                    IFeatureSet reFeatureSet = new FeatureSet();
                    reFeatureSet.Features.Add(feature);
                    //有待检验能否检测出其他异常
                    reFeatureSet.SelectByAttribute("");
                    corList.Add(i);
                }
                catch
                {
                    //featureSet.Features.RemoveAt(i);
                }
            }
            corFeatureSet = corFeatureSet.CopySubset(corList);
            return(corFeatureSet);
        }
示例#3
0
        /// <summary>
        /// This builds the _drawnStates based on the current label scheme.
        /// </summary>
        public virtual void CreateLabels()
        {
            if (FeatureSet != null && FeatureSet.IndexMode)
            {
                CreateIndexedLabels();
                return;
            }

            DrawnStates = new Dictionary <IFeature, LabelDrawState>();
            if (FeatureSet == null || Symbology == null)
            {
                return;
            }

            foreach (ILabelCategory category in Symbology.Categories)
            {
                List <IFeature> features = !string.IsNullOrWhiteSpace(category.FilterExpression) ? FeatureSet.SelectByAttribute(category.FilterExpression) : FeatureSet.Features.ToList();

                foreach (IFeature feature in features)
                {
                    if (DrawnStates.ContainsKey(feature))
                    {
                        DrawnStates[feature] = new LabelDrawState(category);
                    }
                    else
                    {
                        DrawnStates.Add(feature, new LabelDrawState(category));
                    }
                }
            }
        }