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);
        }
Beispiel #2
0
        protected void SetRuleFieldName()
        {
            ReportVariantProperty dataValue = this.m_mapRule.DataValue;

            if (dataValue == null)
            {
                this.m_ruleFieldName  = RuleMapper.m_distinctBucketFieldName;
                this.m_coreRule.Field = this.m_ruleFieldName;
                this.m_fieldNameBased = true;
            }
            else if (this.m_mapVectorLayer.MapDataRegion == null)
            {
                object obj = this.EvaluateRuleDataValue();
                if (obj is string)
                {
                    string text = (string)obj;
                    if (text.StartsWith("#", StringComparison.Ordinal))
                    {
                        this.m_ruleFieldName  = SpatialDataMapper.GetUniqueFieldName(this.m_mapVectorLayer.Name, text.Remove(0, 1));
                        this.m_coreRule.Field = this.m_ruleFieldName;
                        this.m_fieldNameBased = true;
                    }
                }
            }
        }
Beispiel #3
0
        public void SetRuleFieldValue(ISpatialElement spatialElement)
        {
            if (this.m_fieldNameBased.HasValue && this.m_fieldNameBased.Value)
            {
                return;
            }
            object obj = this.EvaluateRuleDataValue();

            if (obj != null)
            {
                if (!this.m_fieldNameBased.HasValue)
                {
                    TypeCode typeCode = Type.GetTypeCode(obj.GetType());
                    if (typeCode == TypeCode.String && ((string)obj).StartsWith("#", StringComparison.Ordinal))
                    {
                        this.m_ruleFieldName  = SpatialDataMapper.GetUniqueFieldName(this.m_mapVectorLayer.Name, ((string)obj).Remove(0, 1));
                        this.m_coreRule.Field = this.m_ruleFieldName;
                        this.m_fieldNameBased = true;
                        return;
                    }
                }
                if (this.m_ruleFieldName == null)
                {
                    this.m_ruleFieldName  = this.m_coreSpatialElementManager.AddRuleField(obj);
                    this.m_fieldNameBased = false;
                    this.m_coreRule.Field = this.m_ruleFieldName;
                }
                this.m_coreSpatialElementManager.AddFieldValue(spatialElement, this.m_ruleFieldName, obj);
            }
        }
Beispiel #4
0
        private static object GetBindingFieldValue(ISpatialElement coreSpatialElement, MapBindingFieldPair bindingFieldPair, string mapName, string layerName)
        {
            string bindingFieldName = SpatialDataMapper.GetBindingFieldName(bindingFieldPair);

            if (bindingFieldName == null)
            {
                return(null);
            }
            return(coreSpatialElement[SpatialDataMapper.GetUniqueFieldName(layerName, bindingFieldName)]);
        }
Beispiel #5
0
        public static SpatialElementKey CreateCoreSpatialElementKey(ISpatialElement coreSpatialElement, MapBindingFieldPairCollection mapBindingFieldPairs, string mapName, string layerName)
        {
            if (mapBindingFieldPairs == null)
            {
                return(new SpatialElementKey(null));
            }
            List <object> list = new List <object>();

            for (int i = 0; i < mapBindingFieldPairs.Count; i++)
            {
                list.Add(SpatialDataMapper.GetBindingFieldValue(coreSpatialElement, ((ReportElementCollectionBase <MapBindingFieldPair>)mapBindingFieldPairs)[i], mapName, layerName));
            }
            return(new SpatialElementKey(list));
        }
        private void GetFieldNameMapping(out string[] dbfNames, out string[] uniqueNames)
        {
            MapFieldNameCollection mapFieldNames = this.m_shapefile.MapFieldNames;

            if (mapFieldNames == null)
            {
                dbfNames    = null;
                uniqueNames = null;
            }
            else
            {
                dbfNames    = new string[mapFieldNames.Count];
                uniqueNames = new string[mapFieldNames.Count];
                for (int i = 0; i < mapFieldNames.Count; i++)
                {
                    string fieldName = base.GetFieldName(((ReportElementCollectionBase <MapFieldName>)mapFieldNames)[i]);
                    dbfNames[i]    = fieldName;
                    uniqueNames[i] = SpatialDataMapper.GetUniqueFieldName(base.m_mapVectorLayer.Name, fieldName);
                }
            }
        }
        private void CreateSpatialDataMapper()
        {
            MapSpatialData mapSpatialDatum = this.m_mapVectorLayer.MapSpatialData;

            if (this.IsEmbeddedLayer)
            {
                this.m_spatialDataMapper = new EmbeddedSpatialDataMapper(this, this.m_spatialElementsDictionary, this.SpatialElementCollection, this.GetSpatialElementManager(), this.m_coreMap, this.m_mapMapper);
            }
            else if (this.m_mapVectorLayer.MapSpatialData is MapSpatialDataSet)
            {
                this.m_spatialDataMapper = new SpatialDataSetMapper(this, this.m_spatialElementsDictionary, this.GetSpatialElementManager(), this.m_coreMap, this.m_mapMapper);
            }
            else if (this.m_mapVectorLayer.MapSpatialData is MapShapefile)
            {
                this.m_spatialDataMapper = new ShapefileMapper(this, this.m_spatialElementsDictionary, this.m_coreMap, this.m_mapMapper);
            }
            else
            {
                this.m_spatialDataMapper = null;
            }
        }
Beispiel #8
0
 private SpatialElementKey CreateCoreSpatialElementKey(ISpatialElement coreSpatialElement)
 {
     return(SpatialDataMapper.CreateCoreSpatialElementKey(coreSpatialElement, this.m_mapVectorLayer.MapBindingFieldPairs, this.m_mapVectorLayer.MapDef.Name, this.m_mapVectorLayer.Name));
 }
Beispiel #9
0
 protected string GetUniqueFieldName(string fieldName)
 {
     return(SpatialDataMapper.GetUniqueFieldName(this.m_mapVectorLayer.Name, fieldName));
 }
 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])));
     }
 }