예제 #1
0
        public override bool Equals(object obj)
        {
            SpatialElementKey spatialElementKey = (SpatialElementKey)obj;

            if (this.m_keyValues != null && spatialElementKey.m_keyValues != null)
            {
                if (this.m_keyValues.Count != spatialElementKey.m_keyValues.Count)
                {
                    return(false);
                }
                for (int i = 0; i < this.m_keyValues.Count; i++)
                {
                    object obj2 = this.m_keyValues[i];
                    if (obj2 == null)
                    {
                        return(false);
                    }
                    if (!obj2.Equals(spatialElementKey.m_keyValues[i]))
                    {
                        return(false);
                    }
                }
                return(true);
            }
            return(false);
        }
        private List <ISpatialElement> GetElementViewSpatialElements(MapElementView mapView)
        {
            MapBindingFieldPairCollection mapBindingFieldPairs = mapView.MapBindingFieldPairs;

            if (mapBindingFieldPairs == null)
            {
                return(null);
            }
            SpatialElementKey      obj  = VectorLayerMapper.CreateDataRegionSpatialElementKey(mapBindingFieldPairs);
            List <ISpatialElement> list = null;

            foreach (KeyValuePair <SpatialElementKey, SpatialElementInfoGroup> item in this.m_spatialElementsDictionary)
            {
                foreach (SpatialElementInfo element in item.Value.Elements)
                {
                    if (SpatialDataMapper.CreateCoreSpatialElementKey(element.CoreSpatialElement, mapView.MapBindingFieldPairs, this.m_mapVectorLayer.MapDef.Name, this.m_mapVectorLayer.Name).Equals(obj))
                    {
                        if (list == null)
                        {
                            list = new List <ISpatialElement>();
                        }
                        list.Add(element.CoreSpatialElement);
                    }
                }
            }
            return(list);
        }
 public void ValidateKey(SpatialElementKey spatialElementKey, MapBindingFieldPairCollection mapBindingFieldPairs)
 {
     if (this.m_spatialDataMapper.KeyTypes != null)
     {
         int num = 0;
         while (true)
         {
             if (num < spatialElementKey.KeyValues.Count)
             {
                 object obj = spatialElementKey.KeyValues[num];
                 if (obj != null)
                 {
                     Type type  = obj.GetType();
                     Type type2 = this.m_spatialDataMapper.KeyTypes[num];
                     if (type2 != null && type != type2)
                     {
                         object obj2 = VectorLayerMapper.Convert(obj, type, type2);
                         if (obj2 == null)
                         {
                             break;
                         }
                         spatialElementKey.KeyValues[num] = obj2;
                     }
                 }
                 num++;
                 continue;
             }
             return;
         }
         throw new RenderingObjectModelException(RPRes.rsMapFieldBindingExpressionTypeMismatch(RPRes.rsObjectTypeMap, this.m_mapVectorLayer.MapDef.Name, this.m_mapVectorLayer.Name, SpatialDataMapper.GetBindingFieldName(((ReportElementCollectionBase <MapBindingFieldPair>)mapBindingFieldPairs)[num])));
     }
 }
예제 #4
0
 private void RegisterKeyTypes(SpatialElementKey key)
 {
     this.m_keyTypes = new List <Type>();
     foreach (object keyValue in key.KeyValues)
     {
         if (keyValue == null)
         {
             this.m_keyTypes.Add(null);
         }
         else
         {
             this.m_keyTypes.Add(keyValue.GetType());
         }
     }
 }
        private SpatialElementInfoGroup GetSpatialElementsFromDataRegionKey()
        {
            MapBindingFieldPairCollection mapBindingFieldPairs = this.m_mapVectorLayer.MapBindingFieldPairs;

            if (mapBindingFieldPairs != null)
            {
                SpatialElementKey spatialElementKey = VectorLayerMapper.CreateDataRegionSpatialElementKey(mapBindingFieldPairs);
                this.ValidateKey(spatialElementKey, mapBindingFieldPairs);
                SpatialElementInfoGroup result = default(SpatialElementInfoGroup);
                if (this.m_spatialElementsDictionary.TryGetValue(spatialElementKey, out result))
                {
                    return(result);
                }
            }
            return(null);
        }
예제 #6
0
        protected void OnSpatialElementAdded(SpatialElementInfo spatialElementInfo)
        {
            this.m_vectorLayerMapper.OnSpatialElementAdded(spatialElementInfo.CoreSpatialElement);
            this.m_mapMapper.OnSpatialElementAdded(spatialElementInfo);
            SpatialElementKey spatialElementKey = this.CreateCoreSpatialElementKey(spatialElementInfo.CoreSpatialElement);

            if (this.m_mapVectorLayer.MapDataRegion != null && this.m_keyTypes == null && spatialElementKey.KeyValues != null)
            {
                this.RegisterKeyTypes(spatialElementKey);
            }
            SpatialElementInfoGroup spatialElementInfoGroup;

            if (!this.m_spatialElementsDictionary.ContainsKey(spatialElementKey))
            {
                spatialElementInfoGroup = new SpatialElementInfoGroup();
                this.m_spatialElementsDictionary.Add(spatialElementKey, spatialElementInfoGroup);
            }
            else
            {
                spatialElementInfoGroup = this.m_spatialElementsDictionary[spatialElementKey];
            }
            spatialElementInfoGroup.Elements.Add(spatialElementInfo);
        }