コード例 #1
0
        private List <ISpatialElement> GetElementViewSpatialElements(MapElementView mapView)
        {
            MapBindingFieldPairCollection mapBindingFieldPairs = mapView.MapBindingFieldPairs;

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

            foreach (KeyValuePair <SpatialElementKey, SpatialElementInfoGroup> item in m_spatialElementsDictionary)
            {
                foreach (SpatialElementInfo element in item.Value.Elements)
                {
                    if (SpatialDataMapper.CreateCoreSpatialElementKey(element.CoreSpatialElement, mapView.MapBindingFieldPairs, m_mapVectorLayer.MapDef.Name, m_mapVectorLayer.Name).Equals(obj))
                    {
                        if (list == null)
                        {
                            list = new List <ISpatialElement>();
                        }
                        list.Add(element.CoreSpatialElement);
                    }
                }
            }
            return(list);
        }
コード例 #2
0
        internal void ValidateKey(SpatialElementKey spatialElementKey, MapBindingFieldPairCollection mapBindingFieldPairs)
        {
            if (m_spatialDataMapper.KeyTypes == null)
            {
                return;
            }
            int num = 0;

            while (true)
            {
                if (num >= spatialElementKey.KeyValues.Count)
                {
                    return;
                }
                object obj = spatialElementKey.KeyValues[num];
                if (obj != null)
                {
                    Type type  = obj.GetType();
                    Type type2 = m_spatialDataMapper.KeyTypes[num];
                    if (!(type2 == null) && type != type2)
                    {
                        object obj2 = Convert(obj, type, type2);
                        if (obj2 == null)
                        {
                            break;
                        }
                        spatialElementKey.KeyValues[num] = obj2;
                    }
                }
                num++;
            }
            throw new RenderingObjectModelException(RPRes.rsMapFieldBindingExpressionTypeMismatch(RPRes.rsObjectTypeMap, m_mapVectorLayer.MapDef.Name, m_mapVectorLayer.Name, SpatialDataMapper.GetBindingFieldName(mapBindingFieldPairs[num])));
        }
コード例 #3
0
        public override bool Equals(object obj)
        {
            SpatialElementKey spatialElementKey = (SpatialElementKey)obj;

            if (m_keyValues == null || spatialElementKey.m_keyValues == null)
            {
                return(false);
            }
            if (m_keyValues.Count != spatialElementKey.m_keyValues.Count)
            {
                return(false);
            }
            for (int i = 0; i < m_keyValues.Count; i++)
            {
                object obj2 = m_keyValues[i];
                if (obj2 == null)
                {
                    return(false);
                }
                if (!obj2.Equals(spatialElementKey.m_keyValues[i]))
                {
                    return(false);
                }
            }
            return(true);
        }
コード例 #4
0
        private SpatialElementInfoGroup GetSpatialElementsFromDataRegionKey()
        {
            MapBindingFieldPairCollection mapBindingFieldPairs = m_mapVectorLayer.MapBindingFieldPairs;

            if (mapBindingFieldPairs != null)
            {
                SpatialElementKey spatialElementKey = CreateDataRegionSpatialElementKey(mapBindingFieldPairs);
                ValidateKey(spatialElementKey, mapBindingFieldPairs);
                if (m_spatialElementsDictionary.TryGetValue(spatialElementKey, out SpatialElementInfoGroup value))
                {
                    return(value);
                }
            }
            return(null);
        }
コード例 #5
0
 private void RegisterKeyTypes(SpatialElementKey key)
 {
     m_keyTypes = new List <Type>();
     foreach (object keyValue in key.KeyValues)
     {
         if (keyValue == null)
         {
             m_keyTypes.Add(null);
         }
         else
         {
             m_keyTypes.Add(keyValue.GetType());
         }
     }
 }
コード例 #6
0
        protected void OnSpatialElementAdded(SpatialElementInfo spatialElementInfo)
        {
            m_vectorLayerMapper.OnSpatialElementAdded(spatialElementInfo.CoreSpatialElement);
            m_mapMapper.OnSpatialElementAdded(spatialElementInfo);
            SpatialElementKey spatialElementKey = CreateCoreSpatialElementKey(spatialElementInfo.CoreSpatialElement);

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

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