Example #1
0
        public static double GetEffectiveTextHeight(IDimensionStyle dimensionStyle, double scale)
        {
            DxfTextStyle textStyle = dimensionStyle.TextStyle;

            if (textStyle != null && textStyle.FixedHeight != 0.0)
            {
                return(textStyle.FixedHeight);
            }
            return(dimensionStyle.TextHeight * scale);
        }
Example #2
0
        public DimensionStyleSelectionProperty(string resourceId, DimensionStyleList list, IDimensionStyle dimensionStyle, Dimension.EDimType dimType, bool includeUndefined) : base()
        {
            base.resourceId     = resourceId;
            this.dimensionStyle = dimensionStyle;
            List <DimensionStyle> al = new List <DimensionStyle>();

            for (int i = 0; i < list.Count; ++i)
            {
                if (dimType == Dimension.EDimType.DimAll || (((int)(list[i].Types)) & (1 << (int)dimType)) != 0)
                {
                    al.Add(list[i]);
                }
            }
            DimensionStyle nd = new DimensionStyle();

            if (al.Count == 0)
            {
                al.Add(DimensionStyle.GetDefault());
            }
            selectableStyles = al.ToArray();
            if (includeUndefined)
            {
                base.choices = new string[selectableStyles.Length + 1];
                for (int i = 0; i < selectableStyles.Length; ++i)
                {
                    base.choices[i + 1] = selectableStyles[i].Name;
                }
                string undef = StringTable.GetString("DimensionStyle.Undefined");
                // sollte es den Namen schon geben, werden solange - davor und dahintergemacht, bis es den Namen mehr gibt
                // while (Find(undef)!=null) undef = "-" + undef +"-";
                choices[0] = undef;
                if (dimensionStyle.DimensionStyle != null)
                {
                    selectedText = dimensionStyle.DimensionStyle.Name;
                }
                else
                {
                    selectedText = undef;
                }
            }
            else
            {
                base.choices = new string[selectableStyles.Length];
                for (int i = 0; i < selectableStyles.Length; ++i)
                {
                    base.choices[i] = selectableStyles[i].Name;
                }
                if (dimensionStyle.DimensionStyle != null)
                {
                    base.selectedText = dimensionStyle.DimensionStyle.Name;
                }
            }
            toWatch = dimensionStyle as IGeoObject;
        }
Example #3
0
 /// <summary>
 /// Checks whether an <see cref="IGeoObject"/> is accepted by this filter.
 /// To realize custom filters, override this method.
 /// </summary>
 /// <param name="go">The object beeing tested</param>
 /// <returns>true if accepted, fale otherwise</returns>
 public virtual bool Accept(IGeoObject go)
 {
     // jetzt so implementiert: wenn ein Attribut verlangt wird und ein Objekt nicht das
     // passende Interface hat, dann wird es nicht akzeptiert
     // wenn z.B. der Layer eines Objektes null ist, dann wird dieses von keinem Filter anerkannt
     if (acceptedLayers.Count > 0)
     {
         ILayer ilayer = go as ILayer;
         if (ilayer == null)
         {
             return(false);
         }
         if (ilayer.Layer == null)
         {
             return(false);
         }
         if (!acceptedLayers.ContainsKey(ilayer.Layer))
         {
             return(false);
         }
     }
     if (acceptedColorDefs.Count > 0)
     {
         IColorDef iColorDef = go as IColorDef;
         if (iColorDef == null)
         {
             return(false);
         }
         if (iColorDef.ColorDef == null)
         {
             return(false);
         }
         if (!acceptedColorDefs.ContainsKey(iColorDef.ColorDef))
         {
             return(false);
         }
     }
     if (acceptedLineWidths.Count > 0)
     {
         ILineWidth iLineWidth = go as ILineWidth;
         if (iLineWidth == null)
         {
             return(false);
         }
         if (iLineWidth.LineWidth == null)
         {
             return(false);
         }
         if (!acceptedLineWidths.ContainsKey(iLineWidth.LineWidth))
         {
             return(false);
         }
     }
     if (acceptedLinePatterns.Count > 0)
     {
         ILinePattern iLinePattern = go as ILinePattern;
         if (iLinePattern == null)
         {
             return(false);
         }
         if (iLinePattern.LinePattern == null)
         {
             return(false);
         }
         if (!acceptedLinePatterns.ContainsKey(iLinePattern.LinePattern))
         {
             return(false);
         }
     }
     if (acceptedDimensionStyles.Count > 0)
     {
         IDimensionStyle iDimensionStyle = go as IDimensionStyle;
         if (iDimensionStyle == null)
         {
             return(false);
         }
         if (iDimensionStyle.DimensionStyle == null)
         {
             return(false);
         }
         if (!acceptedDimensionStyles.ContainsKey(iDimensionStyle.DimensionStyle))
         {
             return(false);
         }
     }
     if (acceptedHatchStyles.Count > 0)
     {
         IHatchStyle iHatchStyle = go as IHatchStyle;
         if (iHatchStyle == null)
         {
             return(false);
         }
         if (iHatchStyle.HatchStyle == null)
         {
             return(false);
         }
         if (!acceptedHatchStyles.ContainsKey(iHatchStyle.HatchStyle))
         {
             return(false);
         }
     }
     if (acceptedTypes.Count > 0)
     {
         if (!acceptedTypes.ContainsKey(go.GetType()))
         {
             return(false);
         }
     }
     return(true);
 }
Example #4
0
 public static double GetEffectiveTextHeight(IDimensionStyle dimensionStyle)
 {
     return(DxfDimensionStyle.GetEffectiveTextHeight(dimensionStyle, dimensionStyle.ScaleFactor));
 }