Exemple #1
0
        internal void SetRuleFieldValue(ISpatialElement spatialElement)
        {
            if (m_fieldNameBased.HasValue && m_fieldNameBased.Value)
            {
                return;
            }
            object obj = EvaluateRuleDataValue();

            if (obj == null)
            {
                return;
            }
            if (!m_fieldNameBased.HasValue && Type.GetTypeCode(obj.GetType()) == TypeCode.String && ((string)obj).StartsWith("#", StringComparison.Ordinal))
            {
                m_ruleFieldName  = SpatialDataMapper.GetUniqueFieldName(m_mapVectorLayer.Name, ((string)obj).Remove(0, 1));
                m_coreRule.Field = m_ruleFieldName;
                m_fieldNameBased = true;
                return;
            }
            if (m_ruleFieldName == null)
            {
                m_ruleFieldName  = m_coreSpatialElementManager.AddRuleField(obj);
                m_fieldNameBased = false;
                m_coreRule.Field = m_ruleFieldName;
            }
            m_coreSpatialElementManager.AddFieldValue(spatialElement, m_ruleFieldName, obj);
        }
Exemple #2
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);
            }
        }
        private static object GetBindingFieldValue(ISpatialElement coreSpatialElement, MapBindingFieldPair bindingFieldPair, string mapName, string layerName)
        {
            string bindingFieldName = GetBindingFieldName(bindingFieldPair);

            if (bindingFieldName == null)
            {
                return(null);
            }
            return(coreSpatialElement[GetUniqueFieldName(layerName, bindingFieldName)]);
        }
Exemple #4
0
 public bool HasDataValue(ISpatialElement element)
 {
     if (this.m_mapRule.DataValue != null)
     {
         if (element[this.m_coreRule.Field] != null)
         {
             return(this.IsValueInRange(this.m_coreRule.Field, element));
         }
         return(false);
     }
     return(true);
 }
Exemple #5
0
 internal bool HasDataValue(ISpatialElement element)
 {
     if (m_mapRule.DataValue != null)
     {
         if (element[m_coreRule.Field] != null)
         {
             return(IsValueInRange(m_coreRule.Field, element));
         }
         return(false);
     }
     return(true);
 }
        /*
         *      public ISpatialElement AddGeography(SqlGeography geography, string layerName)
         *      {
         *              if (geography == null)
         *              {
         *                      return null;
         *              }
         *              if (geography.IsNull)
         *              {
         *                      return null;
         *              }
         *              ISpatialElement spatialElement = this.CreateSpatialElement();
         *              spatialElement.Layer = layerName;
         *              spatialElement.Category = layerName;
         *              this.AddSpatialElement(spatialElement);
         *              if (!spatialElement.AddGeography(geography))
         *              {
         *                      this.RemoveSpatialElement(spatialElement);
         *                      return null;
         *              }
         *              return spatialElement;
         *      }
         *
         *      public ISpatialElement AddGeometry(SqlGeometry geometry, string layerName)
         *      {
         *              if (geometry == null)
         *              {
         *                      return null;
         *              }
         *              if (geometry.IsNull)
         *              {
         *                      return null;
         *              }
         *              ISpatialElement spatialElement = this.CreateSpatialElement();
         *              spatialElement.Layer = layerName;
         *              spatialElement.Category = layerName;
         *              if (spatialElement.AddGeometry(geometry))
         *              {
         *                      this.AddSpatialElement(spatialElement);
         *                      return spatialElement;
         *              }
         *              return null;
         *      }
         */
        public ISpatialElement AddWKB(string wkb, string layerName)
        {
            ISpatialElement spatialElement = this.CreateSpatialElement();

            spatialElement.Layer    = layerName;
            spatialElement.Category = layerName;
            if (spatialElement.AddWKB(Convert.FromBase64String(wkb)))
            {
                this.AddSpatialElement(spatialElement);
                return(spatialElement);
            }
            return(null);
        }
        internal 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(GetBindingFieldValue(coreSpatialElement, mapBindingFieldPairs[i], mapName, layerName));
            }
            return(new SpatialElementKey(list));
        }
Exemple #8
0
 private void ProcessNonSpatialFields(ISpatialElement spatialElement, FieldInfo[] nonSpatialFieldInfos)
 {
     if (nonSpatialFieldInfos != null)
     {
         foreach (FieldInfo fieldInfo in nonSpatialFieldInfos)
         {
             if (!fieldInfo.DefinitionAdded)
             {
                 fieldInfo.DefinitionAdded = this.AddFieldDefinition(fieldInfo.UniqueName, this.m_dataSetInstance.Row[fieldInfo.Index].Value);
             }
             this.m_spatialElementManager.AddFieldValue(spatialElement, fieldInfo.UniqueName, this.m_dataSetInstance.Row[fieldInfo.Index].Value);
         }
     }
 }
Exemple #9
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 AddSpatialElement(MapSpatialElement embeddedElement)
 {
     if (base.m_mapMapper.CanAddSpatialElement)
     {
         ISpatialElement spatialElement = this.m_spatialElementManager.AddWKB(embeddedElement.VectorData, base.m_mapVectorLayer.Name);
         if (spatialElement != null)
         {
             this.ProcessNonSpatialFields(embeddedElement, spatialElement);
             SpatialElementInfo spatialElementInfo = new SpatialElementInfo();
             spatialElementInfo.CoreSpatialElement = spatialElement;
             spatialElementInfo.MapSpatialElement  = embeddedElement;
             base.OnSpatialElementAdded(spatialElementInfo);
         }
     }
 }
Exemple #11
0
 protected void RenderStyle(Style style, StyleInstance styleInstance, ISpatialElement coreSpatialElement, bool ignoreBackgroundColor, bool hasScope)
 {
     if (!ignoreBackgroundColor)
     {
         coreSpatialElement.Color = this.GetBackgroundColor(style, styleInstance, hasScope);
     }
     coreSpatialElement.SecondaryColor = this.GetBackGradientEndColor(style, styleInstance, hasScope);
     coreSpatialElement.GradientType   = this.GetGradientType(style, styleInstance, hasScope);
     coreSpatialElement.HatchStyle     = this.GetHatchStyle(style, styleInstance, hasScope);
     coreSpatialElement.ShadowOffset   = this.GetShadowOffset(style, styleInstance, hasScope);
     coreSpatialElement.BorderColor    = this.GetBorderColor(style, styleInstance, hasScope);
     coreSpatialElement.BorderWidth    = this.GetBorderWidth(style, styleInstance, hasScope);
     coreSpatialElement.TextColor      = this.GetTextColor(style, styleInstance, hasScope);
     coreSpatialElement.Font           = this.GetFont(style, styleInstance, hasScope);
 }
 internal void AddFieldValue(ISpatialElement spatialElement, string fieldName, object value)
 {
     try
     {
         spatialElement[fieldName] = value;
     }
     catch (Exception e)
     {
         if (AsynchronousExceptionDetection.IsStoppingException(e))
         {
             throw;
         }
         spatialElement[fieldName] = value.ToString();
         m_mapVectorLayer.MapDef.RenderingContext.OdpContext.ErrorContext.Register(ProcessingErrorCode.rsMapUnsupportedValueFieldType, Severity.Warning, m_mapVectorLayer.MapDef.MapDef.ObjectType, m_mapVectorLayer.MapDef.Name, m_mapVectorLayer.Name, fieldName);
     }
 }
Exemple #13
0
        private bool IsValueInRange(string fieldName, ISpatialElement element)
        {
            Type   type       = ((Microsoft.Reporting.Map.WebForms.Field)m_coreSpatialElementManager.FieldDefinitions.GetByName(fieldName)).Type;
            object startValue = GetStartValue(type);
            object endValue   = GetEndValue(type);

            if (type == typeof(int))
            {
                if (startValue != null && (int)startValue > (int)element[fieldName])
                {
                    return(false);
                }
                if (endValue != null && (int)endValue < (int)element[fieldName])
                {
                    return(false);
                }
            }
            else if (type == typeof(double))
            {
                if (startValue != null && (double)startValue > (double)element[fieldName])
                {
                    return(false);
                }
                if (endValue != null && (double)endValue < (double)element[fieldName])
                {
                    return(false);
                }
            }
            else if (type == typeof(decimal))
            {
                if (startValue != null && (decimal)startValue > (decimal)element[fieldName])
                {
                    return(false);
                }
                if (endValue != null && (decimal)endValue < (decimal)element[fieldName])
                {
                    return(false);
                }
            }
            return(true);
        }
        private void ProcessNonSpatialFields(MapSpatialElement embeddedElement, ISpatialElement spatialElement)
        {
            MapFieldCollection mapFields = embeddedElement.MapFields;

            if (mapFields != null)
            {
                MapFieldDefinitionCollection mapFieldDefinitions = base.m_mapVectorLayer.MapFieldDefinitions;
                if (mapFieldDefinitions != null)
                {
                    foreach (MapField item in mapFields)
                    {
                        MapFieldDefinition fieldDefinition = mapFieldDefinitions.GetFieldDefinition(item.Name);
                        if (fieldDefinition == null)
                        {
                            throw new RenderingObjectModelException(RPRes.rsMapInvalidFieldName(RPRes.rsObjectTypeMap, base.m_mapVectorLayer.MapDef.Name, base.m_mapVectorLayer.Name, item.Name));
                        }
                        this.m_spatialElementManager.AddFieldValue(spatialElement, base.GetUniqueFieldName(item.Name), this.GetFieldValue(item.Value, fieldDefinition.DataType));
                    }
                }
            }
        }
        private SpatialElementInfoGroup CreateSpatialElementFromDataRegion()
        {
            //IL_0047: Unknown result type (might be due to invalid IL or missing references)
            //IL_005c: Expected O, but got Unknown
            //IL_006e: Unknown result type (might be due to invalid IL or missing references)
            //IL_0083: Expected O, but got Unknown
            if (!m_mapMapper.CanAddSpatialElement)
            {
                return(null);
            }
            MapSpatialDataRegion mapSpatialDataRegion = (MapSpatialDataRegion)m_mapVectorLayer.MapSpatialData;

            if (mapSpatialDataRegion == null)
            {
                return(null);
            }
            object vectorData = mapSpatialDataRegion.Instance.VectorData;

            if (vectorData == null)
            {
                return(null);
            }
            ISpatialElement spatialElement = null;

            if (spatialElement == null)
            {
                return(null);
            }
            SpatialElementInfo spatialElementInfo = new SpatialElementInfo();

            spatialElementInfo.CoreSpatialElement = spatialElement;
            spatialElementInfo.MapSpatialElement  = null;
            SpatialElementInfoGroup spatialElementInfoGroup = new SpatialElementInfoGroup();

            spatialElementInfoGroup.Elements.Add(spatialElementInfo);
            m_spatialElementsDictionary.Add(new SpatialElementKey(null), spatialElementInfoGroup);
            OnSpatialElementAdded(spatialElement);
            m_mapMapper.OnSpatialElementAdded(spatialElementInfo);
            return(spatialElementInfoGroup);
        }
 internal abstract void OnSpatialElementAdded(ISpatialElement spatialElement);
 internal abstract bool IsValidSpatialElement(ISpatialElement spatialElement);
 public override void AddSpatialElement(ISpatialElement spatialElement)
 {
     ((NamedElement)spatialElement).Name = base.m_coreMap.Paths.Count.ToString(CultureInfo.InvariantCulture);
     base.m_coreMap.Paths.Add((Path)spatialElement);
 }
 protected void InitializeSpatialElement(ISpatialElement spatialElement)
 {
     spatialElement.Text = "";
 }
 internal abstract void RemoveSpatialElement(ISpatialElement spatialElement);
 public override void RemoveSpatialElement(ISpatialElement spatialElement)
 {
     base.m_coreMap.Paths.Remove((Path)spatialElement);
 }
 internal override void OnSpatialElementAdded(ISpatialElement spatialElement)
 {
 }
 internal abstract void AddSpatialElement(ISpatialElement spatialElement);
 internal override void RemoveSpatialElement(ISpatialElement spatialElement)
 {
     m_coreMap.Symbols.Remove((Symbol)spatialElement);
 }
 internal override bool IsValidSpatialElement(ISpatialElement spatialElement)
 {
     return(spatialElement is Symbol);
 }
 internal override void AddSpatialElement(ISpatialElement spatialElement)
 {
     ((NamedElement)spatialElement).Name = m_coreMap.Symbols.Count.ToString(CultureInfo.InvariantCulture);
     m_coreMap.Symbols.Add((Symbol)spatialElement);
 }
Exemple #27
0
 public override void OnSpatialElementAdded(ISpatialElement spatialElement)
 {
     base.m_mapMapper.Simplify((Shape)spatialElement);
 }
Exemple #28
0
 public override bool IsValidSpatialElement(ISpatialElement spatialElement)
 {
     return(spatialElement is Shape);
 }
 public override void RemoveSpatialElement(ISpatialElement spatialElement)
 {
     base.m_coreMap.Symbols.Remove((Symbol)spatialElement);
 }
 private SpatialElementKey CreateCoreSpatialElementKey(ISpatialElement coreSpatialElement)
 {
     return(CreateCoreSpatialElementKey(coreSpatialElement, m_mapVectorLayer.MapBindingFieldPairs, m_mapVectorLayer.MapDef.Name, m_mapVectorLayer.Name));
 }